Up
Authors
- Richard Frith-Macdonald (
rfm@gnu.org
)
-
Copyright: (C) 2004 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSXMLParser.h
Availability: MacOS-X 10.3.0
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.
Method summary
- (void)
abortParsing;
Availability: MacOS-X 10.3.0
Terminates the current parse operation and sends
an error to the delegate of the parser.
- (id)
delegate;
Availability: MacOS-X 10.3.0
Returns the delegate previously set using
-setDelegate:
or
nil
if no delegate is set.
- (id)
initWithContentsOfURL: (
NSURL*)anURL;
Availability: MacOS-X 10.3.0
Convenience method fetching data from
anURL.
- (id)
initWithData: (
NSData*)data;
Availability: MacOS-X 10.3.0
This is a designated initialiser for the class.
Initialises the parser with the specified xml
data.
- (BOOL)
parse;
Availability: MacOS-X 10.3.0
Parses the supplied data and returns
YES
on success, NO
otherwise.
- (
NSError*)
parserError;
Availability: MacOS-X 10.3.0
Returns the last error produced by parsing (if
any).
- (void)
setDelegate: (id)delegate;
Availability: MacOS-X 10.3.0
Sets the parser delegate (which is not
retained).
- (void)
setShouldProcessNamespaces: (BOOL)aFlag;
Availability: MacOS-X 10.3.0
- (void)
setShouldReportNamespacePrefixes: (BOOL)aFlag;
Availability: MacOS-X 10.3.0
- (void)
setShouldResolveExternalEntities: (BOOL)aFlag;
Availability: MacOS-X 10.3.0
- (BOOL)
shouldProcessNamespaces;
Availability: MacOS-X 10.3.0
- (BOOL)
shouldReportNamespacePrefixes;
Availability: MacOS-X 10.3.0
- (BOOL)
shouldResolveExternalEntities;
Availability: MacOS-X 10.3.0
- Declared in:
- Foundation/NSXMLParser.h
Availability: MacOS-X 10.3.0
Methods implemented by a delegate in order to make
use of the parser.
This is an informal protocol.
Method summary
- (void)
parser: (
NSXMLParser*)aParser
didEndElement: (
NSString*)anElementName
namespaceURI: (
NSString*)aNamespaceURI
qualifiedName: (
NSString*)aQualifierName;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
didEndMappingPrefix: (
NSString*)aPrefix;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
didStartElement: (
NSString*)anElementName
namespaceURI: (
NSString*)aNamespaceURI
qualifiedName: (
NSString*)aQualifierName
attributes: (
NSDictionary*)anAttributeDict;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
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.
- (void)
parser: (
NSXMLParser*)aParser
didStartMappingPrefix: (
NSString*)aPrefix
toURI: (
NSString*)aNamespaceURI;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundAttributeDeclarationWithName: (
NSString*)anAttributeName
forElement: (
NSString*)anElementName
type: (
NSString*)aType
defaultValue: (
NSString*)aDefaultValue;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundCDATA: (
NSData*)aBlock;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundCharacters: (
NSString*)aString;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundComment: (
NSString*)aComment;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundElementDeclarationWithName: (
NSString*)anElementName
model: (
NSString*)aModel;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundExternalEntityDeclarationWithName: (
NSString*)aName
publicID: (
NSString*)aPublicID
systemID: (
NSString*)aSystemID;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundIgnorableWhitespace: (
NSString*)aWhitespaceString;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundInternalEntityDeclarationWithName: (
NSString*)aName
value: (
NSString*)aValue;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundNotationDeclarationWithName: (
NSString*)aName
publicID: (
NSString*)aPublicID
systemID: (
NSString*)aSystemID;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundProcessingInstructionWithTarget: (
NSString*)aTarget
data: (
NSString*)aData;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
foundUnparsedEntityDeclarationWithName: (
NSString*)aName
publicID: (
NSString*)aPublicID
systemID: (
NSString*)aSystemID
notationName: (
NSString*)aNotationName;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
parseErrorOccurred: (
NSError*)anError;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (
NSData*)
parser: (
NSXMLParser*)aParser
resolveExternalEntityName: (
NSString*)aName
systemID: (
NSString*)aSystemID;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parser: (
NSXMLParser*)aParser
validationErrorOccurred: (
NSError*)anError;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Description forthcoming.
- (void)
parserDidEndDocument: (
NSXMLParser*)aParser;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Called when parsing ends.
- (void)
parserDidStartDocument: (
NSXMLParser*)aParser;
Availability: MacOS-X 10.3.0
An empty method provided for subclasses to override.
Called when parsing begins.
- Declared in:
- Foundation/NSXMLParser.h
Availability: MacOS-X 10.3.0
Description forthcoming.
Method summary
- (int)
columnNumber;
Availability: MacOS-X 10.3.0
Returns the current column number of the document
being parsed.
- (int)
lineNumber;
Availability: MacOS-X 10.3.0
Returns the current line number of the document
being parsed.
- (
NSString*)
publicID;
Availability: MacOS-X 10.3.0
Returns the public identifier of the external
entity in the document being parsed.
- (
NSString*)
systemID;
Availability: MacOS-X 10.3.0
Returns the system identifier of the external
entity in the document being parsed.
Up