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()

leave
KXmlEngErrParsing Parsing error
leave
KXmlEngErrWrongUseOfAPI OpenL() or ParseChunkL() not previously called
leave
  • One of the system-wide error codes

Returns: The created document

GetLastParsingError ( )

IMPORT_C TIntGetLastParsingError()

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

See also: xmlengerrors.h

Returns: 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.

ParameterDescription
aDOMImplDOM implementation object previously opened without error.

Returns: 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()

leave
KXmlEngErrParsing Parsing error
leave
KXmlEngErrWrongUseOfAPI OpenL() not previously called
leave
  • One of the system-wide error codes

ParameterDescription
aBufferXML data buffer

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()

leave
KXmlEngErrParsing Parsing error
leave
KXmlEngErrWrongUseOfAPI OpenL() not previously called
leave
  • One of the system-wide error codes

ParameterDescription
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.

Returns: The created document

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()

leave
KXmlEngErrParsing Parsing error
leave
KXmlEngErrWrongUseOfAPI OpenL() not previously called
leave
  • One of the system-wide error codes

ParameterDescription
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.

Returns: The created document

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()

leave
KXmlEngErrParsing Parsing error
leave
KXmlEngErrWrongUseOfAPI OpenL() not previously called
leave
  • One of the system-wide error codes

ParameterDescription
aBufferXML data buffer

Returns: The created document