Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <parser.h>
Link against: xmlframework.lib

Class Xml::CParser

class CParser : public CBase;

Description

If you need to parse xml this is the class you need to use.

Default plain-text XML parser plug-in supports following character set encodings:

ISO_8859_1 US_ASCII UTF_8 UTF_16 UTF_16BE UTF_16LE

Derivation

Members

Defined in Xml::CParser:

Inherited from CBase:

Related Topics


Construction and destruction


NewL(const TDesC8 &,MContentHandler &)

IMPORT_C static CParser* NewL(const TDesC8 &aParserMimeType, MContentHandler &aCallback);

Description

This method creates a parser that is ready to parse documents of the specified mime type.

If there are multiple parser plugins in the system which can parse the mime type, the XML framework will choose a parser.

The criteria used to choose a parser, from many matching parsers, is as follows:

Parameters

const TDesC8 &aParserMimeType

The mime type of the documents to parse (e.g. "txt/xml").

Xml::MContentHandler &aCallback

The handler for parser generated events.

Return value

Xml::CParser *

A constructed parser

Leave codes

KErrNoMemory

If there is not enough memory to create parser or one of system wide error codes.

KErrXmlParserPluginNotFound

If Xml framework is unable to find a parser based on data provided in aParserMimeType.

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h

See also:


NewLC(const TDesC8 &,MContentHandler &)

IMPORT_C static CParser* NewLC(const TDesC8 &aParserMimeType, MContentHandler &aCallback);

Description

This method is similar to NewL, but leaves the created parser on the cleanup stack.

Parameters

const TDesC8 &aParserMimeType

The mime type of the documents to parse (e.g. "txt/xml").

Xml::MContentHandler &aCallback

The handler for parser generated events.

Return value

Xml::CParser *

A constructed parser

Leave codes

KErrNoMemory

If there is not enough memory to create parser or one of system wide error codes.

KErrXmlParserPluginNotFound

If Xml framework is unable to find a parser based on data provided in aParserMimeType.

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h

See also:


NewL(const CMatchData &,MContentHandler &)

IMPORT_C static CParser* NewL(const CMatchData &aCriteria, MContentHandler &aCallback);

Description

This method creates the particular parser specified in Xml::CMatchData parameter.

The parser plugin resolution process is based on mime type and variant field. Both are provided in Xml::CMatchData parameter. Mime Type is a mandatory string for the resolution process and it is matched against the data field of plugin resource files. Variant string is optional. If it exists, it is matched against the first entry of the opaque data field of plugin resource files.

If the query is narrowed down to many parsers, the XML framework might either leave with an error (KErrXmlMoreThanOneParserMatched), or choose a parser. The behaviour is specified by LeaveOnMany flag. The default value of the flag is FALSE ('choose a parser' behaviour).

The criteria used to choose a parser, from many matching parsers, is as follows:

Case sensitivity of the string matching process is applied according to the relevant flag in Xml::CMatchData. The default value is TRUE (Case Sensitivity enabled).

Only ROM-based parsers are returned if the relevant flag is set in Xml::CMatchData. The default value is FALSE (all parsers are considered).

Parameters

const Xml::CMatchData &aCriteria

The specific information about required parser (mime type, variant data).

Xml::MContentHandler &aCallback

The xml/wbxml event handler.

Return value

Xml::CParser *

A constructed parser

Leave codes

KErrNoMemory

If there is not enough memory to create parser or one of system wide error codes.

KErrXmlParserPluginNotFound

If Xml framework is unable to find a parser based on data provided in CMatchData.

KErrXmlMoreThanOneParserMatched

If Xml framework narrowed down the query to many parsers and a user requested to leave in such case (LeaveOnMany flag set).

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h

See also:


NewLC(const CMatchData &,MContentHandler &)

IMPORT_C static CParser* NewLC(const CMatchData &aCriteria, MContentHandler &aCallback);

Description

This method creates the particular parser specified in Xml::CMatchData parameter. It performs the same way as NewL with the exception that it leaves the object on the cleanup stack.

Parameters

const Xml::CMatchData &aCriteria

The specific information about required parser (mime type, version, variant data).

Xml::MContentHandler &aCallback

The xml/wbxml event handler.

Return value

Xml::CParser *

A constructed parser

Leave codes

KErrNoMemory

If there is not enough memory to create parser or one of system wide error codes.

KErrXmlParserPluginNotFound

If Xml framework is unable to find a parser based on data provided in CMatchData.

KErrXmlMoreThanOneParserMatched

If Xml framework narrowed down the query to many parsers and a user requested to leave in such case (LeaveOnMany flag set).

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h

See also:


~CParser()

virtual ~CParser();

Description

This method is the destructor for the object.

[Top]


Member functions


ParseBeginL()

IMPORT_C void ParseBeginL();

Description

This method tells the parser that we're going to start parsing a document using the default mime type specified on construction.

The processor chain and features will be cleared if the parser currently set is not the default, all old features are removed as these generally have no meaning between parsers.

Leave codes

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h


ParseBeginL(const TDesC8 &)

IMPORT_C void ParseBeginL(const TDesC8 &aDocumentMimeType);

Description

This method tells the parser that we're going to start parsing a document using the parser associated with this mime type.

Parameters

const TDesC8 &aDocumentMimeType

the mime type of the document


ParseBeginL(const CMatchData &)

IMPORT_C void ParseBeginL(const CMatchData &aCriteria);

Description

This method tells the parser that we're going to start parsing a document using the parser associated with given Xml::CMatchData criteria.

Parameters

const Xml::CMatchData &aCriteria

The specific information about required parser (mime type, version, variant data).

Leave codes

KErrNoMemory

If there is not enough memory to create parser.

KErrArgument

If the data specified in CMatchData are not sufficient.

KErrXmlParserPluginNotFound

If Xml framework is unable to find a parser based on data provided in CMatchData.

KErrXmlMoreThanOneParserMatched

If Xml framework narrowed down the query to many parsers and a user requested to leave in such case (LeaveOnMany flag set).

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h

See also:


ParseL(const TDesC8 &)

IMPORT_C void ParseL(const TDesC8 &aFragment);

Description

This method tells the parser to parse a fragment of a document. Could be the whole document. ParseEndL should be called once the whole document has been parsed.

The parser currently set will be used.

Parameters

const TDesC8 &aFragment

the fragment to parse

Leave codes

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h


ParseEndL()

IMPORT_C void ParseEndL();

Description

This method tells the parser that we've finished parsing the current document and should be called after calling Xml::CParser::ParseL(const TDesC8 &) for the final time, as this will initiate error callbacks via Xml::MContentHandler, and clean up memory where appropriate, should an error have occured during the parsing process. Such an error could occur when trying to parse a truncated document.

Leave codes

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h


SetProcessorChainL(const RContentProcessorUids &)

IMPORT_C void SetProcessorChainL(const RContentProcessorUids &aPlugins);

Description

This method changes the client and plugin chain.

Parameters

const RArray &aPlugins

a list of plugin implementation uids that make up the callback chain.

Leave codes

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h


EnableFeature(TInt)

IMPORT_C TInt EnableFeature(TInt aParserFeature);

Description

This method enables a specific feature of the parser.

Parameters

TInt aParserFeature

The parser feature that must be enabled.

Return value

TInt

KErrNone if successful, KErrNotSupported if the parser doesn't support the feature.


DisableFeature(TInt)

IMPORT_C TInt DisableFeature(TInt aParserFeature);

Description

This method disables a specific feature of the parser.

Parameters

TInt aParserFeature

The parser feature that must be disabled.

Return value

TInt

KErrNone if successful, KErrNotSupported if the feature can't be disabled.


IsFeatureEnabled(TInt)const

IMPORT_C TBool IsFeatureEnabled(TInt aParserFeature) const;

Description

This method tell whether a specific feature of the parser is enabled.

Parameters

TInt aParserFeature

Return value

TBool

True if the feature is enabled.


AddPreloadedDictionaryL(const TDesC8 &)

IMPORT_C void AddPreloadedDictionaryL(const TDesC8 &aPublicId);

Description

This method preloads a string dictionary prior to parsing.

Parameters

const TDesC8 &aPublicId

the public identifier representing the document dtd.

Leave codes

...

One of the system wide error codes or one of the Xml specific ones defined in XmlFrameworkErrors.h


StringPool()

IMPORT_C RStringPool& StringPool();

Description

This method obtains a handle to the current string pool.

Return value

RStringPool &

handle to the current string pool.


StringDictionaryCollection()

IMPORT_C RStringDictionaryCollection& StringDictionaryCollection();

Description

This method obtains a handle to the current StringDictionaryCollection.

Return value

Xml::RStringDictionaryCollection &

handle to the current StringDictionaryCollection.