The XML parser base class.
More...
#include "murl_util_xml_parser.h"
Inherited by Murl::Resource::XmlAnimation::Parser, Murl::Resource::XmlAtlas::Parser, Murl::Resource::XmlDictionary::Parser, Murl::Resource::XmlGraph::Parser, Murl::Resource::XmlImage::Parser, Murl::Resource::XmlPackage::Parser, and Murl::Resource::XmlShader::Parser.
The XML parser base class.
A xml parser class has to derive from the XmlParser and implement at least the CanParseRoot(), ParseRoot() and ParseElement() method.
◆ Parse() [1/2]
virtual Bool Murl::Util::XmlParser::Parse |
( |
const ConstData & |
data | ) |
|
|
virtual |
◆ Parse() [2/2]
Start parsing a data object.
Use this overloaded method if you e.g. expect file names in the XML data being parsed to be relative to some base path. See Parse(const ConstData& data), which parses XML data relative to the current path.
- Parameters
-
data | The data object to parse. |
basePath | The base path to use. |
- Returns
- true if successful.
◆ HasError()
virtual Bool Murl::Util::XmlParser::HasError |
( |
| ) |
const |
|
virtual |
Check if the last Parse() was not successful.
- Returns
- true if the last Parse() was not successful.
◆ GetErrorString()
virtual const String& Murl::Util::XmlParser::GetErrorString |
( |
| ) |
const |
|
virtual |
Get the error string of the last Parse().
- Returns
- The error string of the last Parse().
◆ SetTraceUnusedAttributes()
virtual void Murl::Util::XmlParser::SetTraceUnusedAttributes |
( |
Bool |
enable | ) |
|
|
virtual |
Enable / disable tracing of unused attributes during Parse().
Trace all unused attributes at the end of each StartElement() call if enabled.
- Parameters
-
enable | Set to true to enable or false to disable tracing. |
◆ SetTracePrefix()
virtual void Murl::Util::XmlParser::SetTracePrefix |
( |
const String & |
prefix | ) |
|
|
virtual |
Set the tracing prefix string.
The default prefix string is "Util::XmlParser".
- Parameters
-
◆ StartElement()
◆ EndElement()
Report an end tag.
- Parameters
-
name | The tag name. |
attributes | The attributes. |
- Returns
- true if successful.
◆ StartCData()
virtual Bool Murl::Util::XmlParser::StartCData |
( |
| ) |
|
|
protectedvirtual |
Report the begin of a CDATA section.
- Returns
- true if successful.
◆ EndCData()
virtual Bool Murl::Util::XmlParser::EndCData |
( |
| ) |
|
|
protectedvirtual |
Report the end of a CDATA section.
- Returns
- true if successful.
◆ CanParseRoot()
virtual Bool Murl::Util::XmlParser::CanParseRoot |
( |
const String & |
name | ) |
|
|
protectedpure virtual |
Check if the root tag is valid.
- Parameters
-
- Returns
- true if the root tag is valid, if false is returned the parsing of this tag of all nested tags is skipped.
◆ ParseRoot()
Parse the root tag and attributes.
- Parameters
-
name | The tag name. |
attributes | The attributes. |
- Returns
- true if successful, if false is returned the parsing of this tag and all nested tags is skipped.
◆ ParseElement()
Parse a tag and attributes.
- Parameters
-
name | The tag name. |
attributes | The attributes. |
- Returns
- true if successful, if false is returned the parsing of this tag and all nested tags is skipped.
◆ ParseCharacterData()
virtual Bool Murl::Util::XmlParser::ParseCharacterData |
( |
const String & |
name, |
|
|
const String & |
data |
|
) |
| |
|
protectedvirtual |
Parse the characters between a start / end tag.
- Parameters
-
name | The tag name. |
data | The characters string. |
- Returns
- true if successful.
◆ GetCurrentLevel()
virtual SInt32 Murl::Util::XmlParser::GetCurrentLevel |
( |
| ) |
const |
|
protectedvirtual |
Get the current tag level.
The current tag level is the nested tag counter which starts with zero at the root tag.
- Returns
- The current tag level or -1 if the parser is not active.
◆ GetCurrentLine()
virtual UInt32 Murl::Util::XmlParser::GetCurrentLine |
( |
| ) |
const |
|
protectedvirtual |
Get the line number from the current parsing position.
- Returns
- The current line number, zero if the parser is not active.
◆ GetCurrentColumn()
virtual UInt32 Murl::Util::XmlParser::GetCurrentColumn |
( |
| ) |
const |
|
protectedvirtual |
Get the column number from the current parsing position.
- Returns
- The current column number, zero if the parser is not active.
◆ AppendError()
virtual Bool Murl::Util::XmlParser::AppendError |
( |
const String & |
errorText | ) |
|
|
protectedvirtual |
Append a text to the error string.
After parsing the error string can be retreived by GetErrorString().
- Parameters
-
errorText | The text to append, the current line number is inserted in front of the error text automatically. |
- Returns
- true if successful, false if the parser is not active.
◆ GetBasePath()
virtual String Murl::Util::XmlParser::GetBasePath |
( |
| ) |
const |
|
protectedvirtual |
Get the base path set when Parse() was called.
- Returns
- The base path for the current parsing operation.
◆ TraceUnusedAttributes()
virtual void Murl::Util::XmlParser::TraceUnusedAttributes |
( |
const Attributes & |
attributes | ) |
|
|
protectedvirtual |
Trace all unused attributes.
Uses the prefix set by SetTracePrefix().
- Parameters
-
attributes | The attributes. |
The documentation for this class was generated from the following file: