# NSXMLParser class documentation

rfm@gnu.org
2004 Free Software Foundation, Inc.
Software documentation for the NSXMLParser class
Foundation/NSXMLParser.h
This class is a PRE-ALPHA implementation. You should be prepared to track down and fix bugs and preferably contribute fixes back.
If you don't want to do that, use the GSXMLParser class instead... This NSXMLParser class is implemented as a wrapper round some of the functionality of the more powerful GSXML APIs, and is intended as a MacOSX compatibility feature.

This class implements an event driven parser handling the parsing process by sending messages to a delegate when certain parts of the XML document being parsed are encountered.

To use the class, you create and initialise an instance with a particular XML document, set the delegate of the instance, and send a -parse message to it. The delegate must then make use of the information it receives in the messages it gets from the parser.

The NSObject(NSXMLParserDelegateEventAdditions)informal protocol documents the methods which the delegate object may implement in order to handle the parsing process.

Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
abortParsing
Terminates the current parse operation and sends an error to the delegate of the parser.
delegate
Returns the delegate previously set using -setDelegate: or `nil` if no delegate is set.
initWithContentsOfURL:
anURL
Convenience method fetching data from anURL.
initWithData:
data
Initialises the parser with the specified xml data.
parse
Parses the supplied data and returns `YES` on success, `NO` otherwise.
parserError
Returns the last error produced by parsing (if any).
setDelegate:
delegate
Sets the parser delegate (which is not retained).
setShouldProcessNamespaces:
aFlag
Set flag to determine whether the namespaceURI and the qualified name of an element is provided in the [NSObject(NSXMLParserDelegateEventAdditions) -parser:didStartElement:namespaceURI:qualifiedName:attributes:] and [NSObject(NSXMLParserDelegateEventAdditions) -parser:didEndElement:namespaceURI:qualifiedName:] methods.
setShouldReportNamespacePrefixes:
aFlag
Sets a flag to specify whether the parser should call the [NSObject(NSXMLParserDelegateEventAdditions) -parser:didStartMappingPrefix:toURI:] and [NSObject(NSXMLParserDelegateEventAdditions) -parser:didEndMappingPrefix:] delegate methods.
setShouldResolveExternalEntities:
aFlag
Sets flag to determine if declarations of external entities are reported using [NSObject(NSXMLParserDelegateEventAdditions) -parser:foundExternalEntityDeclarationWithName:publicID:systemID:]
shouldProcessNamespaces
Returns the value set by -setShouldProcessNamespaces:
shouldReportNamespacePrefixes
Returns the value set by -setShouldReportNamespacePrefixes:
shouldResolveExternalEntities
Returns the value set by -setShouldResolveExternalEntities:
Software documentation for the NSObject(NSXMLParserDelegateEventAdditions) category
Foundation/NSXMLParser.h
Description forthcoming.
parser:
aParser
didEndElement:
anElementName
namespaceURI:
aNamespaceURI
qualifiedName:
aQualifierName
Description forthcoming.
parser:
aParser
didEndMappingPrefix:
aPrefix
Description forthcoming.
parser:
aParser
didStartElement:
anElementName
namespaceURI:
aNamespaceURI
qualifiedName:
aQualifierName
attributes:
anAttributeDict
Called when the start of an element is encountered in the document, this provides the name of the element, a dictionary containing the attributes (if any) and (where namespaces are used) the namespace information for the element.
parser:
aParser
didStartMappingPrefix:
aPrefix
toURI:
aNamespaceURI
Description forthcoming.
parser:
aParser
foundAttributeDeclarationWithName:
anAttributeName
forElement:
anElementName
type:
aType
defaultValue:
aDefaultValue
Description forthcoming.
parser:
aParser
foundCDATA:
aBlock
Description forthcoming.
parser:
aParser
foundCharacters:
aString
Description forthcoming.
parser:
aParser
foundComment:
aComment
Description forthcoming.
parser:
aParser
foundElementDeclarationWithName:
anElementName
model:
aModel
Description forthcoming.
parser:
aParser
foundExternalEntityDeclarationWithName:
aName
publicID:
aPublicID
systemID:
aSystemID
Description forthcoming.
parser:
aParser
foundIgnorableWhitespace:
aWhitespaceString
Description forthcoming.
parser:
aParser
foundInternalEntityDeclarationWithName:
aName
value:
aValue
Description forthcoming.
parser:
aParser
foundNotationDeclarationWithName:
aName
publicID:
aPublicID
systemID:
aSystemID
Description forthcoming.
parser:
aParser
foundProcessingInstructionWithTarget:
aTarget
data:
aData
Description forthcoming.
parser:
aParser
foundUnparsedEntityDeclarationWithName:
aName
publicID:
aPublicID
systemID:
aSystemID
notationName:
aNotationName
Description forthcoming.
parser:
aParser
parseErrorOccurred:
anError
Description forthcoming.
parser:
aParser
resolveExternalEntityName:
aName
systemID:
aSystemID
Description forthcoming.
parser:
aParser
validationErrorOccurred:
anError
Description forthcoming.
parserDidEndDocument:
aParser
Called when parsing ends.
parserDidStartDocument:
aParser
Called when parsing begins.
Software documentation for the NSXMLParser(NSXMLParserLocatorAdditions) category
Foundation/NSXMLParser.h
Description forthcoming.
columnNumber
Returns the current column number of the document being parsed.
lineNumber
Returns the current line number of the document being parsed.
publicID
Returns the public identifier of the external entity in the document being parsed.
systemID
Returns the system identifier of the external entity in the document being parsed.
Software documentation for the NSXMLParserDelegate protocol
Foundation/NSXMLParser.h
NSObject
Methods implemented by a delegate in order to make use of the parser.
This is now a formal protocol.