Skip to content
Objective-C Ruby
Find file
Latest commit 0a2050e Jul 1, 2015 @nfarina Pod fixes
Update project for Xcode 7
Failed to load latest commit information.
XMLDocumentSamples Pod fixes Jul 1, 2015
SMXMLDocument.podspec Pod fixes Jul 2, 2015


SMXMLDocument is a very handy lightweight XML parser for iOS.

In brief:

// create a new SMXMLDocument with the contents of sample.xml
SMXMLDocument *document = [SMXMLDocument documentWithData:data error:&error];

// 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

  // show off some KVC magic
  NSArray *authors = [[book childNamed:@"authors"].children valueForKey:@"value"];

  // do interesting things...

More info in the blog post:

Non-ARC Support

Try the master_no_arc branch if your project has Automatic Reference Counting (ARC) disabled.

Something went wrong with that request. Please try again.