Class: NSXMLParser

Inherits:
NSObject show all

Overview

Instances of this class parse XML documents (including DTD declarations) in an event-driven manner. An NSXMLParser notifies its delegate about the items (elements, attributes, CDATA blocks, comments, and so on) that it encounters as it processes an XML document. It does not itself do anything with those parsed items except report them. It also reports parsing errors. For convenience, an NSXMLParser object in the following descriptions is sometimes referred to as a parser object.

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Method Details

- (Object) abortParsing

Stops the parser object. If you invoke this method, the delegate, if it implements parser:parseErrorOccurred:, is informed of the cancelled parsing operation.

Returns:

- (Integer) columnNumber

Returns the column number of the XML document being processed by the receiver. The column refers to the nesting level of the XML elements in the document. You may invoke this method once a parsing operation has begun or after an error occurs.

Returns:

- (Object) delegate

Returns the receiver’s delegate.

Returns:

- (Object) initWithContentsOfURL(url)

Initializes the receiver with the XML content referenced by the given URL.

Parameters:

  • url (NSURL)

    An NSURL object specifying a URL. The URL must be fully qualified and refer to a scheme that is supported by the NSURL class.

Returns:

- (Object) initWithData(data)

Initializes the receiver with the XML contents encapsulated in a given data object. This method is the designated initializer.

Parameters:

Returns:

- (Object) initWithStream(stream)

Initializes the receiver with the XML contents from the specified stream and parses it..

Parameters:

  • stream (NSInputStream)

    The input stream. The content is incrementally loaded from the specified stream and parsed.

Returns:

- (Integer) lineNumber

Returns the line number of the XML document being processed by the receiver. You may invoke this method once a parsing operation has begun or after an error occurs.

Returns:

- (Boolean) parse

Starts the event-driven parsing operation.

Returns:

  • (Boolean)

    YES if parsing is successful and NO in there is an error or if the parsing operation is aborted.

- (NSError) parserError

Returns an NSError object from which you can obtain information about a parsing error. You may invoke this method after a parsing operation abnormally terminates to determine the cause of error.

Returns:

- (String) publicID

Returns the public identifier of the external entity referenced in the XML document. You may invoke this method once a parsing operation has begun or after an error occurs.

Returns:

- (Object) setDelegate(delegate)

Sets the receiver’s delegate.

Parameters:

  • delegate (Object)

    An object that is the new delegate. It is not retained. The delegate must conform to the NSXMLParserDelegate Protocol protocol.

Returns:

- (Object) setShouldProcessNamespaces(shouldProcessNamespaces)

Specifies whether the receiver reports the namespace and the qualified name of an element in related delegation methods . The invoked delegation methods are parser:didStartElement:namespaceURI:qualifiedName:attributes: and parser:didEndElement:namespaceURI:qualifiedName:.

Parameters:

  • shouldProcessNamespaces (Boolean)

    YES if the receiver should report the namespace and qualified name of each element, NO otherwise. The default value is NO.

Returns:

- (Object) setShouldReportNamespacePrefixes(shouldReportNamespacePrefixes)

Specifies whether the receiver reports the scope of namespace declarations using related delegation methods. The invoked delegation methods are parser:didStartMappingPrefix:toURI: and parser:didEndMappingPrefix:.

Parameters:

  • shouldReportNamespacePrefixes (Boolean)

    YES if the receiver should report the scope of namespace declarations, NO otherwise. The default value is NO.

Returns:

- (Object) setShouldResolveExternalEntities(shouldResolveExternalEntities)

Specifies whether the receiver reports declarations of external entities using the delegate method parser:foundExternalEntityDeclarationWithName:publicID:systemID:. If you pass in YES, you may cause other I/O operations, either network-based or disk-based, to load the external DTD.

Parameters:

  • shouldResolveExternalEntities (Boolean)

    YES if the receiver should report declarations of external entities, NO otherwise. The default value is NO.

Returns:

- (Boolean) shouldProcessNamespaces

Indicates whether the receiver reports the namespace and the qualified name of an element in related delegation methods. The invoked delegation methods are parser:didStartElement:namespaceURI:qualifiedName:attributes: and parser:didEndElement:namespaceURI:qualifiedName:.

Returns:

  • (Boolean)

    YES if the receiver reports namespace and qualified name, NO otherwise.

- (Boolean) shouldReportNamespacePrefixes

Indicates whether the receiver reports the prefixes indicating the scope of namespace declarations using related delegation methods. The invoked delegation methods are parser:didStartMappingPrefix:toURI: and parser:didEndMappingPrefix:.

Returns:

  • (Boolean)

    YES if the receiver reports the scope of namespace declarations, NO otherwise. The default value is NO.

- (Boolean) shouldResolveExternalEntities

Indicates whether the receiver reports declarations of external entities using the delegate method parser:foundExternalEntityDeclarationWithName:publicID:systemID:.

Returns:

  • (Boolean)

    YES if the receiver reports declarations of external entities, NO otherwise. The default value is NO.

- (String) systemID

Returns the system identifier of the external entity referenced in the XML document. You may invoke this method once a parsing operation has begun or after an error occurs.

Returns: