xmldom::DomLSParser Class Reference

#include <DomLSParser.h>

List of all members.


Detailed Description

An interface to an object that is able to build, or augment, a DOM tree from various input sources.

DomLSParser provides an API for parsing XML and building the corresponding DOM document structure. A DomLSParser instance can be obtained by invoking the DomImplementationLS::createLSParser() method.

As specified in [DOM Level 3 Core], when a document is first made available via the DomLSParser:

Asynchronous DomLSParser objects are expected to also implement the events::EventTarget interface so that event listeners can be registered on asynchronous DomLSParser objects.

Events supported by asynchronous DomLSParser objects are:

load
The DomLSParser finishes to load the document. See also the definition of the DomLSLoadEvent interface.
progress
The DomLSParser signals progress as data is parsed.
This specification does not attempt to define exactly when progress events should be dispatched. That is intentionally left as implementation-dependent. Here is one example of how an application might dispatch progress events: Once the parser starts receiving data, a progress event is dispatched to indicate that the parsing starts. From there on, a progress event is dispatched for every 4096 bytes of data that is received and processed. This is only one example, though, and implementations can choose to dispatch progress events at any time while parsing, or not dispatch them at all.
See also the definition of the DomLSProgressEvent interface.
Note:
All events defined in this specification use the namespace URI "http://www.w3.org/2002/DOMLS".
While parsing an input source, errors are reported to the application through the error handler (DomLSParser.getDomConfiguration()'s "error-handler" parameter). This specification does in no way try to define all possible errors that can occur while parsing XML, or any other markup, but some common error cases are defined. The types (DomError::getType() ) of errors and warnings defined by this specification are:

"check-character-normalization-failure" [error]
Raised if the parameter "check-character-normalization" is set to true and a string is encountered that fails normalization checking.
"doctype-not-allowed" [fatal]
Raised if the configuration parameter "disallow-doctype" is set to true and a doctype is encountered.
"no-input-specified" [fatal]
Raised when loading a document and no input is specified in the DomLSInput object.
"pi-base-uri-not-preserved" [warning]
Raised if a processing instruction is encountered in a location where the base URI of the processing instruction can not be preserved. One example of a case where this warning will be raised is if the configuration parameter "entities" is set to false and the following XML file is parsed:
<!DOCTYPE root [ <!ENTITY e SYSTEM 'subdir/myentity.ent' ]> <root> e; </root>

And subdir/myentity.ent contains:

<one> <two/> </one> <?pi 3.14159?>> <more/>

"unbound-prefix-in-entity" [warning]
An implementation dependent warning that may be raised if the configuration parameter "namespaces" is set to true and an unbound namespace prefix is encountered in an entity's replacement text. Raising this warning is not enforced since some existing parsers may not recognize unbound namespace prefixes in the replacement text of entities.
"unknown-character-denormalization" [fatal]
Raised if the configuration parameter "ignore-unknown-character-denormalizations" is set to false and a character is encountered for which the processor cannot determine the normalization properties.
"unsupported-encoding" [fatal]
Raised if an unsupported encoding is encountered.
"unsupported-media-type" [fatal]
Raised if the configuration parameter "supported-media-types-only" is set to true and an unsupported media type is encountered.
addition to raising the defined errors and warnings, implementations are expected to raise implementation specific errors and warnings for any other error and warning cases such as IO errors (file not found, permission denied,...), XML well-formedness errors, and so on.


Public Member Functions

 DomLSParser ()
 ctor
 DomLSParser (const DomLSParser &copy)
 copy ctor
virtual ~DomLSParser ()
 dtor
const DomLSParseroperator= (const DomLSParser &assign)
 assign
DOM Level 3
DomDocument parse (const DomLSInput &input)
 Parse an XML document from a resource identified by a DomLSInput.
DomDocument parseURI (const DomString &uri)
 Parse an XML document from a location identified by a URI reference [IETF RFC 2396].
Extensions


Constructor & Destructor Documentation

xmldom::DomLSParser::DomLSParser (  ) 

ctor

xmldom::DomLSParser::DomLSParser ( const DomLSParser copy  ) 

copy ctor

xmldom::DomLSParser::~DomLSParser (  )  [virtual]

dtor


Member Function Documentation

const DomLSParser & xmldom::DomLSParser::operator= ( const DomLSParser assign  ) 

assign

DomDocument xmldom::DomLSParser::parse ( const DomLSInput input  ) 

Parse an XML document from a resource identified by a DomLSInput.

Parameters:
input The DomLSInput from which the source of the document is to be read.
Returns:
If the DomLSParser is a synchronous DomLSParser, the newly created and populated DomDocument is returned. If the DomLSParser is asynchronous, null is returned since the document object may not yet be constructed when this method returns.

DomDocument xmldom::DomLSParser::parseURI ( const DomString uri  ) 

Parse an XML document from a location identified by a URI reference [IETF RFC 2396].

If the URI contains a fragment identifier (see section 4.1 in [IETF RFC 2396]), the behavior is not defined by this specification, future versions of this specification may define the behavior.

Parameters:
uri The location of the XML document to be read.
Returns:
If the DomLSParser is a synchronous DomLSParser, the newly created and populated Document is returned, or null if an error occured. If the DomLSParser is asynchronous, null is returned since the document object may not yet be constructed when this method returns.


The documentation for this class was generated from the following files:
Generated on Fri May 30 11:15:12 2008 for XMLDOM by  doxygen 1.5.2