RXmlEngDOMParser Class Reference

#include <xml/dom/xmlengdomparser.h>

class RXmlEngDOMParser
Public Member Functions
RXmlEngDOMParser()
IMPORT_C voidClose()
IMPORT_C RXmlEngDocumentFinishL()
IMPORT_C TIntGetLastParsingError()
IMPORT_C TIntOpen(RXmlEngDOMImplementation &)
IMPORT_C voidParseChunkL(const TDesC8 &)
IMPORT_C RXmlEngDocumentParseFileL(RFs &, const TDesC &, TUint)
IMPORT_C RXmlEngDocumentParseFileL(const TDesC &, TUint)
IMPORT_C RXmlEngDocumentParseL(const TDesC8 &)

Detailed Description

This class implements methods for parsing XML data. XML data may be parsed from a chunk, file, or memory buffer.

Sample code for parsing from buffer:
     RXmlEngDOMImplementation domImpl;
     domImpl.OpenL();              // opening DOM implementation object 
     RXmlEngDOMParser parser;
     parser.Open( domImpl );   // opening parser object
     RXmlEngDocument iDoc;
     iDoc =parser.ParseL( *aInput );   // parsing aInput - buffer  
     iDoc.Close();               // closing all opened objects
     parser.Close();
     domImpl.Close();
Sample code for parsing from file:
     RXmlEngDOMImplementation domImpl;
     domImpl.OpenL();              // opening DOM implementation object 
     RXmlEngDOMParser parser;
     parser.Open( domImpl );   // opening parser object
     RXmlEngDocument iDoc;
     iDoc =parser.ParseFileL( aFileName );   // parsing from file  
     iDoc.Close();               // closing all openend objects
     parser.Close();
     domImpl.Close();

Constructor & Destructor Documentation

RXmlEngDOMParser ( )

IMPORT_CRXmlEngDOMParser()

Default constructor

Member Function Documentation

Close ( )

IMPORT_C voidClose()

Closes the parser.

FinishL ( )

IMPORT_C RXmlEngDocumentFinishL()

Creates a document from chunks of data previously parsed by ParseChunkL(). Should be called after parsing all chunks. Ownership of the returned RXmlEngDocument object is transferred to the caller of the method. RXmlEngDocument::Close() must be called when the document is no longer required.

See also: ParseChunkL()

See also: GetLastParsingError()

Return Value
The created document
Leave Codes
KXmlEngErrParsingParsing error
KXmlEngErrWrongUseOfAPIOpenL() or

GetLastParsingError ( )

IMPORT_C TIntGetLastParsingError()

Return last parsing error code. Error codes are positive numbers.

See also: xmlengerrors.h

Return Value
The last error returned by the parser or KErrNone if none

Open ( RXmlEngDOMImplementation & )

IMPORT_C TIntOpen(RXmlEngDOMImplementation &aDOMImpl)

Opens the parser. The RXmlEngDOMImplementation object passed as an argument may be used by multiple RXmlEngDOMParser objects.

Parameters
aDOMImplDOM implementation object previously opened without error.
Return Value
KErrNone if successful, system wide error code otherwise

ParseChunkL ( const TDesC8 & )

IMPORT_C voidParseChunkL(const TDesC8 &aBuffer)

Parses a chunk of XML data from a memory buffer and builds an internal DOM tree. The DOM tree can be accessed by calling FinishL() to obtain a RXmlEngDocument.

See also: FinishL()

See also: GetLastParsingError()

Parameters
aBufferXML data buffer
Leave Codes
KXmlEngErrParsingParsing error
KXmlEngErrWrongUseOfAPIOpenL() not previously called

ParseFileL ( RFs &, const TDesC &, TUint )

IMPORT_C RXmlEngDocumentParseFileL(RFs &aRFs,
const TDesC &aFileName,
TUintaChunkSize = 0
)

Parses XML file and builds a DOM RXmlEngDocument. Ownership of the returned RXmlEngDocument object is transferred to the caller of the method. RXmlEngDocument::Close() must be called when the document is no longer required.

See also: GetLastParsingError()

Parameters
aRFsOpen file server session
aFileNameFile name
aChunkSizeThe number of bytes to parse from the file at a time, or 0 if the whole file should be parsed at once.
Return Value
The created document
Leave Codes
KXmlEngErrParsingParsing error
KXmlEngErrWrongUseOfAPIOpenL() not previously called

ParseFileL ( const TDesC &, TUint )

IMPORT_C RXmlEngDocumentParseFileL(const TDesC &aFileName,
TUintaChunkSize = 0
)

Parses XML file and builds a DOM RXmlEngDocument. Ownership of the returned RXmlEngDocument object is transferred to the caller of the method. RXmlEngDocument::Close() must be called when the document is no longer required.

See also: GetLastParsingError()

Parameters
aFileNameFile name
aChunkSizeThe number of bytes to parse from the file at a time, or 0 if the whole file should be parsed at once.
Return Value
The created document
Leave Codes
KXmlEngErrParsingParsing error
KXmlEngErrWrongUseOfAPIOpenL() not previously called

ParseL ( const TDesC8 & )

IMPORT_C RXmlEngDocumentParseL(const TDesC8 &aBuffer)

Parses XML data from a memory buffer that holds the entire XML structure and builds a DOM RXmlEngDocument. Ownership of the returned RXmlEngDocument object is transferred to the caller of the method. RXmlEngDocument::Close() must be called when the document is no longer required.

See also: ParseChunkL()

See also: GetLastParsingError()

Parameters
aBufferXML data buffer
Return Value
The created document
Leave Codes
KXmlEngErrParsingParsing error
KXmlEngErrWrongUseOfAPIOpenL() not previously called