
Expatobjc is a small library that allows you to use James Clark's
Expat XML parser library more easily with Objective C.  It provides an
object-oriented interface to the library which is similar to SAX2.

To use it, make a subclass of the XMLParser object that will override
any or all of the following methods based on what parts of the XML
parser document you want to read and analyze:

startElement - for element start tags 
endElement - for element end tags
characters - for PCDATA stuff
processingInstruction - for XML processing instructions
comment - for XML comments
startCdata - for the start of a CDATA section
endCdata - for the end of a CDATA section
externalEntity - for an external entity declaration
unparsedEntityDecl - for an unparsed entity declaration
startPrefixMapping - for the start of a namespace prefix declaration
endPrefixMapping - for the end of a namespace prefix declaration
defaultHandler - for any text that is not parsed above

If namespace processing is active, the element names given to
startElement and endElement are separated by the separator character
given when the parser is first created, e.g. with a separator '|', an
element start tag that looks like:

<abc:test xmlns:abc="http://www.example.com/abc">

will appear to the startElement method as the string
'http://www.example.com/abc|test', just as namespace processing in
Expat works.

You must also provide a replacement for the dataRead method, which is
used by the parser to actually obtain text that is to be parsed as
XML.  Optionally, you may also provide a replacement for the
errorHandler method, which will allow you to catch errors in the
parsing of the text (the default handler will print the error code,
line number, and error text and terminate your program).

Send an init message to initialize the parser object, giving it the
default encoding you want, the separator character for the URI
qualifier and the local name for XML namespace processing (ignored if
namespace processing is disabled), the size of the buffer you want the
processor to be using, and mask bits for what handlers you want to
activate from this table:

XML_PARSE_STARTELEM - for element start tags 
XML_PARSE_ENDELEM - for element end tags
XML_PARSE_CHARACTERS - for PCDATA stuff
XML_PARSE_PROCINSTR - for XML processing instructions
XML_PARSE_COMMENT - for XML comments
XML_PARSE_CDATA - for CDATA sections
XML_PARSE_EXTERNAL_ENTITY - for an external entity declaration
XML_PARSE_UNPARSED_ENTITY - for an unparsed entity declaration
XML_PARSE_NAMESPACE_DECL  - for a namespace prefix declaration
XML_PARSE_DEFAULT - for any text that is not parsed by the selections

Do a bitwise OR (with the '|' operator) to select which of these you
need.  To activate everything, use the XML_PARSE_ALL mask.  It's
probably preferable to just activate what you need, to avoid the
overhead of spurious function calls and messages during parsing, it's
much faster.  XML_PARSE_DEFAULT, if ORed with any mask, will parse any
data which would not otherwise have been visible with the above.

To begin parsing send a start message to the parser object.  It should
then begin parsing the document it obtains from the dataRead method.

For more details about the API and the exact form of the methods, read
the XMLParser.h interface.  For more information, read the Expat
documentation.  For an example of how to use the library, see the
testparser.m code, which basically replicates the example in Clark
Cooper's XML.com article on Expat, but using the object-oriented
interface.
