Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit, contains SMModelObject as we've been using it for a w…

…hile plus a new sample project with demo code.
  • Loading branch information...
commit 3b33548903b083524a1e4fe918ef39644e4d5c5d 0 parents
@nfarina authored
12 .gitignore
@@ -0,0 +1,12 @@
+
+# Mac
+.DS_Store
+
+# Xcode
+build/
+*.mode*
+*.pbxuser
+*~.nib
+
+# Xcode 4
+xcuserdata/
50 SMXMLDocument.h
@@ -0,0 +1,50 @@
+
+// Thanks Apple, for not just exposing NSXMLDocument!
+
+#ifdef __IPHONE_4_0
+@interface SMXMLElement : NSObject<NSXMLParserDelegate> {
+#else
+@interface SMXMLElement : NSObject {
+#endif
+
+@private
+ SMXMLElement *parent; // nonretained
+ NSString *name;
+ NSMutableString *value;
+ NSMutableArray *children;
+ NSDictionary *attributes;
+}
+
+@property (nonatomic, assign) SMXMLElement *parent;
+@property (nonatomic, copy) NSString *name;
+@property (nonatomic, retain) NSString *value;
+@property (nonatomic, retain) NSArray *children;
+@property (nonatomic, readonly) SMXMLElement *firstChild, *lastChild;
+@property (nonatomic, retain) NSDictionary *attributes;
+
+- (SMXMLElement *)childNamed:(NSString *)name;
+- (NSArray *)childrenNamed:(NSString *)name;
+- (SMXMLElement *)childWithAttribute:(NSString *)attributeName value:(NSString *)attributeValue;
+- (NSString *)attributeNamed:(NSString *)name;
+- (SMXMLElement *)descendantWithPath:(NSString *)path;
+- (NSString *)valueWithPath:(NSString *)path;
+
+@end
+
+#ifdef __IPHONE_4_0
+@interface SMXMLDocument : NSObject<NSXMLParserDelegate> {
+#else
+@interface SMXMLDocument : NSObject {
+#endif
+
+@private
+ SMXMLElement *root;
+}
+
+@property (nonatomic, retain) SMXMLElement *root;
+
+- (id)initWithData:(NSData *)data;
+
++ (SMXMLDocument *)documentWithData:(NSData *)data;
+
+@end
170 SMXMLDocument.m
@@ -0,0 +1,170 @@
+#import "SMXMLDocument.h"
+
+@implementation SMXMLElement
+@synthesize parent, name, value, children, attributes;
+
+- (void)dealloc {
+ self.parent = nil;
+ self.name = nil;
+ self.value = nil;
+ self.children = nil;
+ self.attributes = nil;
+ [super dealloc];
+}
+
+- (NSString *)descriptionWithIndent:(NSString *)indent {
+
+ NSMutableString *s = [NSMutableString string];
+ [s appendFormat:@"%@<%@", indent, name];
+
+ for (NSString *attribute in attributes)
+ [s appendFormat:@" %@=\"%@\"", attribute, [attributes objectForKey:attribute]];
+
+ NSString *trimVal = [value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
+
+ if (trimVal.length > 25)
+ trimVal = [NSString stringWithFormat:@"%@", [trimVal substringToIndex:25]];
+
+ if (children.count) {
+ [s appendString:@">\n"];
+
+ NSString *childIndent = [indent stringByAppendingString:@" "];
+
+ if (trimVal.length)
+ [s appendFormat:@"%@%@\n", childIndent, trimVal];
+
+ for (SMXMLElement *child in children)
+ [s appendFormat:@"%@\n", [child descriptionWithIndent:childIndent]];
+
+ [s appendFormat:@"%@</%@>", indent, name];
+ }
+ else if (trimVal.length) {
+ [s appendFormat:@">%@</%@>", trimVal, name];
+ }
+ else [s appendString:@"/>"];
+
+ return s;
+}
+
+- (NSString *)description {
+ return [self descriptionWithIndent:@""];
+}
+
+- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
+
+ if (!string) return;
+
+ if (value)
+ [(NSMutableString *)value appendString:string];
+ else
+ self.value = [NSMutableString stringWithString:string];
+}
+
+- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
+ SMXMLElement *child = [[[SMXMLElement alloc] init] autorelease];
+ child.parent = self;
+ child.name = elementName;
+ child.attributes = attributeDict;
+
+ if (children)
+ [(NSMutableArray *)children addObject:child];
+ else
+ self.children = [NSMutableArray arrayWithObject:child];
+
+ [parser setDelegate:child];
+}
+
+- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
+ [parser setDelegate:parent];
+}
+
+- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
+ NSLog(@"ERROR at line %i col %i while parsing <%@>: %@. Value so far: %@", parser.lineNumber, parser.columnNumber, name, parseError, value);
+}
+
+- (SMXMLElement *)childNamed:(NSString *)nodeName {
+ for (SMXMLElement *child in children)
+ if ([child.name isEqual:nodeName])
+ return child;
+ return nil;
+}
+
+- (NSArray *)childrenNamed:(NSString *)nodeName {
+ NSMutableArray *array = [NSMutableArray array];
+ for (SMXMLElement *child in children)
+ if ([child.name isEqual:nodeName])
+ [array addObject:child];
+ return [[array copy] autorelease];
+}
+
+- (SMXMLElement *)childWithAttribute:(NSString *)attributeName value:(NSString *)attributeValue {
+ for (SMXMLElement *child in children)
+ if ([[child attributeNamed:attributeName] isEqual:attributeValue])
+ return child;
+ return nil;
+}
+
+- (NSString *)attributeNamed:(NSString *)attributeName {
+ return [attributes objectForKey:attributeName];
+}
+
+- (SMXMLElement *)descendantWithPath:(NSString *)path {
+ SMXMLElement *descendant = self;
+ for (NSString *childName in [path componentsSeparatedByString:@"."])
+ descendant = [descendant childNamed:childName];
+ return descendant;
+}
+
+- (NSString *)valueWithPath:(NSString *)path {
+ NSArray *components = [path componentsSeparatedByString:@"@"];
+ SMXMLElement *descendant = [self descendantWithPath:[components objectAtIndex:0]];
+ return [components count] > 1 ? [descendant attributeNamed:[components objectAtIndex:1]] : descendant.value;
+}
+
+
+- (SMXMLElement *)firstChild { return [children count] > 0 ? [children objectAtIndex:0] : nil; }
+- (SMXMLElement *)lastChild { return [children lastObject]; }
+
+@end
+
+@implementation SMXMLDocument
+@synthesize root;
+
+- (id)initWithData:(NSData *)data {
+ if ([super init]) {
+ NSXMLParser *parser = [[[NSXMLParser alloc] initWithData:data] autorelease];
+ [parser setDelegate:self];
+ [parser setShouldProcessNamespaces:YES];
+ [parser setShouldReportNamespacePrefixes:YES];
+ [parser setShouldResolveExternalEntities:NO];
+ [parser parse];
+ }
+ return self;
+}
+
+- (void)dealloc {
+ self.root = nil;
+ [super dealloc];
+}
+
++ (SMXMLDocument *)documentWithData:(NSData *)data {
+ return [[[SMXMLDocument alloc] initWithData:data] autorelease];
+}
+
+- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
+
+ self.root = [[[SMXMLElement alloc] init] autorelease];
+ root.name = elementName;
+ root.attributes = attributeDict;
+ [parser setDelegate:root];
+}
+
+- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError {
+ NSLog(@"ERROR at line %i col %i while parsing root: %@", parser.lineNumber, parser.columnNumber, parseError);
+}
+
+- (NSString *)description {
+ return root.description;
+}
+
+@end
3  XMLDocumentSamples/AppDelegate.h
@@ -0,0 +1,3 @@
+
+@interface AppDelegate : NSObject <UIApplicationDelegate>
+@end
36 XMLDocumentSamples/AppDelegate.m
@@ -0,0 +1,36 @@
+#import "AppDelegate.h"
+#import "SMXMLDocument.h"
+
+@implementation AppDelegate
+
+- (void) applicationDidFinishLaunching:(UIApplication *)application {
+
+ // find "sample.xml" in our bundle resources
+ NSString *sampleXML = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"xml"];
+ NSData *data = [NSData dataWithContentsOfFile:sampleXML];
+
+ // create a new SMXMLDocument with the contents of sample.xml
+ SMXMLDocument *document = [SMXMLDocument documentWithData:data];
+
+ // demonstrate -description of document/element classes
+ NSLog(@"Document:\n %@", document);
+
+ // Pull out the <books> node
+ SMXMLElement *books = [document.root childNamed:@"books"];
+
+ // Look through <books> children of type <book>
+ for (SMXMLElement *book in [books childrenNamed:@"book"]) {
+
+ // demonstrate common cases of extracting XML data
+ NSString *isbn = [book attributeNamed:@"isbn"]; // XML attribute
+ NSString *title = [book valueWithPath:@"title"]; // child node value
+ float price = [[book valueWithPath:@"price"] floatValue]; // child node value (converted)
+
+ // show off some KVC magic
+ NSArray *authors = [[book childNamed:@"authors"].children valueForKey:@"value"];
+
+ NSLog(@"Found a book!\n ISBN: %@ \n Title: %@ \n Price: %f \n Authors: %@", isbn, title, price, authors);
+ }
+}
+
+@end
39 XMLDocumentSamples/XMLDocumentSamples-Info.plist
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
248 XMLDocumentSamples/XMLDocumentSamples.xcodeproj/project.pbxproj
@@ -0,0 +1,248 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 0173BC9C12E765430037CA90 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0173BC9B12E765430037CA90 /* AppDelegate.m */; };
+ 0173BCAA12E7656F0037CA90 /* SMXMLDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 0173BCA812E7656F0037CA90 /* SMXMLDocument.m */; };
+ 0173BCC312E766160037CA90 /* sample.xml in Resources */ = {isa = PBXBuildFile; fileRef = 0173BCC212E766160037CA90 /* sample.xml */; };
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; };
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 0173BC9A12E765430037CA90 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 0173BC9B12E765430037CA90 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 0173BCA812E7656F0037CA90 /* SMXMLDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SMXMLDocument.m; path = ../SMXMLDocument.m; sourceTree = SOURCE_ROOT; };
+ 0173BCA912E7656F0037CA90 /* SMXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SMXMLDocument.h; path = ../SMXMLDocument.h; sourceTree = SOURCE_ROOT; };
+ 0173BCC212E766160037CA90 /* sample.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sample.xml; sourceTree = "<group>"; };
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1D6058910D05DD3D006BFB54 /* XMLDocumentSamples.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = XMLDocumentSamples.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 32CA4F630368D1EE00C91783 /* XMLDocumentSamples_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLDocumentSamples_Prefix.pch; sourceTree = "<group>"; };
+ 8D1107310486CEB800E47090 /* XMLDocumentSamples-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "XMLDocumentSamples-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */,
+ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */,
+ 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 0173BC9912E7653B0037CA90 /* XML Document */ = {
+ isa = PBXGroup;
+ children = (
+ 0173BCA912E7656F0037CA90 /* SMXMLDocument.h */,
+ 0173BCA812E7656F0037CA90 /* SMXMLDocument.m */,
+ );
+ name = "XML Document";
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 1D6058910D05DD3D006BFB54 /* XMLDocumentSamples.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 28EEBF621118D79A00187D67 /* Shared */ = {
+ isa = PBXGroup;
+ children = (
+ 0173BCC212E766160037CA90 /* sample.xml */,
+ 0173BC9A12E765430037CA90 /* AppDelegate.h */,
+ 0173BC9B12E765430037CA90 /* AppDelegate.m */,
+ 8D1107310486CEB800E47090 /* XMLDocumentSamples-Info.plist */,
+ 32CA4F630368D1EE00C91783 /* XMLDocumentSamples_Prefix.pch */,
+ 29B97316FDCFA39411CA2CEA /* main.m */,
+ );
+ name = Shared;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 0173BC9912E7653B0037CA90 /* XML Document */,
+ 28EEBF621118D79A00187D67 /* Shared */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ 288765FC0DF74451002DB57D /* CoreGraphics.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 1D6058900D05DD3D006BFB54 /* XMLDocumentSamples */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "XMLDocumentSamples" */;
+ buildPhases = (
+ 1D60588D0D05DD3D006BFB54 /* Resources */,
+ 1D60588E0D05DD3D006BFB54 /* Sources */,
+ 1D60588F0D05DD3D006BFB54 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = XMLDocumentSamples;
+ productName = XMLDocumentSamples;
+ productReference = 1D6058910D05DD3D006BFB54 /* XMLDocumentSamples.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "XMLDocumentSamples" */;
+ compatibilityVersion = "Xcode 3.1";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ English,
+ Japanese,
+ French,
+ German,
+ );
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 1D6058900D05DD3D006BFB54 /* XMLDocumentSamples */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1D60588D0D05DD3D006BFB54 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 0173BCC312E766160037CA90 /* sample.xml in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 1D60588E0D05DD3D006BFB54 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1D60589B0D05DD56006BFB54 /* main.m in Sources */,
+ 0173BC9C12E765430037CA90 /* AppDelegate.m in Sources */,
+ 0173BCAA12E7656F0037CA90 /* SMXMLDocument.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 1D6058940D05DD3E006BFB54 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = XMLDocumentSamples_Prefix.pch;
+ INFOPLIST_FILE = "XMLDocumentSamples-Info.plist";
+ PRODUCT_NAME = XMLDocumentSamples;
+ };
+ name = Debug;
+ };
+ 1D6058950D05DD3E006BFB54 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = XMLDocumentSamples_Prefix.pch;
+ INFOPLIST_FILE = "XMLDocumentSamples-Info.plist";
+ PRODUCT_NAME = XMLDocumentSamples;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "XMLDocumentSamples" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1D6058940D05DD3E006BFB54 /* Debug */,
+ 1D6058950D05DD3E006BFB54 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "XMLDocumentSamples" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
8 XMLDocumentSamples/XMLDocumentSamples_Prefix.pch
@@ -0,0 +1,8 @@
+//
+// Prefix header for all source files of the 'XMLDocumentSamples' target in the 'XMLDocumentSamples' project
+//
+
+#ifdef __OBJC__
+ #import <Foundation/Foundation.h>
+ #import <UIKit/UIKit.h>
+#endif
8 XMLDocumentSamples/main.m
@@ -0,0 +1,8 @@
+
+int main(int argc, char *argv[]) {
+
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
+ [pool release];
+ return retVal;
+}
20 XMLDocumentSamples/sample.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<results totalResults="74">
+ <books>
+ <book isbn="978-3-16-148410-0">
+ <title>Harry Potter and the Half-Blood Prince</title>
+ <price>29.95</price>
+ <authors>
+ <author>J.K. Rowling</author>
+ </authors>
+ </book>
+ <book isbn="478-2-23-765712-2">
+ <title>Twilight</title>
+ <price>19.95</price>
+ <authors>
+ <author>Stephenie Meyer</author>
+ <author>The Hand of God</author>
+ </authors>
+ </book>
+ </books>
+</results>
Please sign in to comment.
Something went wrong with that request. Please try again.