Robbie Hanson edited this page Aug 23, 2013 · 7 revisions

Getting started using KissXML


On Mac OS X, Apple provides the NSXML class cluster for working with XML elements (NSXMLDocument, NSXMLElement, NSXMLNode). However, they do not provide these classes on iOS. KissXML is designed to be a drop-in replacement for Apple's NSXML class cluster on iOS. (For more information, see the reference page.)

Getting Started

The project contains two folders within its root directory:

  • KissXML - Contains the implementation files.
  • UnitTesting - Various testing code to ensure KissXML operates just like Apple's classes.

To use KissXML within your project, there are two steps:

  1. Copy the KissXML folder into your project (ignore the UnitTesting folder)
  2. Configure Xcode to work with libxml2


The KissXML folder contains:

  • DDXML.h (Standard header file you will #import)
  • DDXMLDocument
  • DDXMLElement
  • DDXMLNode
  • Categories/NSString+DDXML
  • Private/DDXMLPrivate.h
  • Additions/DDXMLElementAdditions (this is optional, all the others listed above are required)

After adding the KissXML folder you'll need to add libxml2 to your Xcode project. There are 2 steps to this process:

  1. Tell Xcode where it can find the libxml2 header files so it will compile
  2. Tell Xcode where it can find the libxml2 compiled library so it will link (last step of compiling)

You'll be adding this to your compiler instructions (at project level, not target level)

  • OTHER_LDFLAGS = -lxml2
  • HEADER_SEARCH_PATHS = /usr/include/libxml2






Automatic Reference Counting (ARC)

The latest versions of KissXML use ARC. If you're not using ARC in your project, learn how to properly flag the KissXML files as ARC in your Xcode project on the ARC page.