A class that models a XML reader object built on top of Xerces-C++. More...
#include <Reader.h>
Public Member Functions | |
std::string | getAttr (const std::string &name) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
std::string | getAttr (std::size_t i) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual double | getAttrAsDouble (const std::string &name) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual double | getAttrAsDouble (std::size_t i) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual boost::int32_t | getAttrAsInt32 (const std::string &name) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual boost::int32_t | getAttrAsInt32 (std::size_t i) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual boost::uint32_t | getAttrAsUInt32 (std::size_t i) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
virtual boost::uint32_t | getAttrAsUInt32 (const std::string name) const |
It returns the attribute value in the case of an element node with valid attributes. More... | |
std::string | getAttrLocalName (std::size_t i) const |
It returns the local part of the attribute name for the i-th attribute. More... | |
std::size_t | getAttrPosition (const std::string &name) const |
It returns the attribute position. More... | |
std::string | getAttrQName (std::size_t i) const |
It returns the qualified name for the i-th attribute. More... | |
std::string | getAttrURI (std::size_t i) const |
It returns the attribute URI of the associated namespace in the case of an element node. More... | |
std::size_t | getElementDataLen () const |
It returns the element data value in the case of VALUE node. More... | |
std::string | getElementLocalName () const |
It returns the local part of the element name in the case of an element node. More... | |
std::string | getElementQName () const |
It returns the qualified name in the case of an element node. More... | |
std::string | getElementURI () const |
It returns the URI of the associated namespace in the case of an element node. More... | |
std::string | getElementValue () const |
It returns the element data value in the case of VALUE node. More... | |
virtual bool | getElementValueAsBoolean () const |
It returns the element data value in the case of VALUE node. More... | |
virtual double | getElementValueAsDouble () const |
It returns the element data value in the case of VALUE node. More... | |
virtual boost::int32_t | getElementValueAsInt32 () const |
It returns the element data value in the case of VALUE node. More... | |
void | getNamespace (std::size_t i, std::pair< std::string, std::string > &ns) const |
te::xml::NodeType | getNodeType () const |
It return the type of node read. More... | |
std::size_t | getNumberOfAttrs () const |
It returns the number of attributes in the case of an element node. More... | |
std::size_t | getNumberOfNamespaces () const |
bool | hasAttrs () const |
It tells if the element has attributes in the case of an element node. More... | |
bool | next () |
It gets the next event to be read. More... | |
void | read (const std::string &fileURI) |
It prepare the given file to be read. More... | |
Reader () | |
Default constructor. More... | |
void | reset () |
It resets the parser. More... | |
void | setCacheGrammarFromParse (bool d) |
If true it caches the grammar in the pool for re-use in subsequent parses. More... | |
void | setDoNamespaces (bool d) |
It enables or disables the parser namespace processing. More... | |
void | setDoSchema (bool d) |
It enables or disables the parser schema processing. More... | |
void | setIgnoreWhiteSpaces (bool d) |
If true the parser will ignore the white space characters. More... | |
void | setInternalBufferSize (const std::size_t size) |
It sets the maximal allowed buffer size used for parsing. More... | |
void | setUseCachedGrammarInParse (bool d) |
If true the reader will use cached grammar if it exists in the pool. More... | |
void | setValidationScheme (bool d) |
If true the parser will perform a validation scheme. More... | |
~Reader () | |
Destructor. More... | |
Private Attributes | |
ErrorHandler * | m_errH |
A pointer to an error handler. More... | |
bool | m_ignoreWhiteSpaces |
A flag that indicates if the parser should ignore white spaces. More... | |
xercesc::SAX2XMLReader * | m_parser |
A pointer to the parser used by the reader. More... | |
ReaderHandler * | m_readerH |
A pointer to a content handler. More... | |
xercesc::XMLPScanToken * | m_token |
This keeps the parser state. More... | |
A class that models a XML reader object built on top of Xerces-C++.
This API is intend to simplify the task of reading XML files. We have tried to model it close to the Libxml2 API (see http://xmlsoft.org/xmlreader.html for more information) but keeping all Xerces-C++ support capabilities: schema validation and grammar cache.
If you prefer to use the SAX or DOM parsers, please, look the Xerces-C++ documentation available at http://xerces.apache.org/xerces-c.
te::xerces::Reader::Reader | ( | ) |
Default constructor.
Definition at line 40 of file Reader.cpp.
References m_errH, m_parser, m_readerH, and TE_XERCES_READER_MAX_BUFFSIZE.
|
virtual |
|
virtual |
It returns the attribute value in the case of an element node with valid attributes.
name | The attribute name. |
Implements te::xml::Reader.
Definition at line 243 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the attribute value in the case of an element node with valid attributes.
i | The attribute position. |
Implements te::xml::Reader.
Definition at line 252 of file Reader.cpp.
References te::xerces::ToString().
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
name | The attribute name. |
Definition at line 69 of file Reader.cpp.
Referenced by te::serialize::xml::ReadBandProperty(), te::serialize::xml::ReadExtent(), and te::serialize::xml::ReadGeoTransform().
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
i | The attribute position. |
Definition at line 74 of file Reader.cpp.
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
name | The attribute name. |
Definition at line 49 of file Reader.cpp.
Referenced by DataSetAdapterLayerReader(), te::serialize::xml::ReadBandProperty(), te::serialize::xml::ReadLiteral(), and te::xsd::serialize::ReadOccurs().
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
i | The attribute position. |
Definition at line 54 of file Reader.cpp.
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
i | The attribute position. |
Definition at line 59 of file Reader.cpp.
Referenced by te::serialize::xml::ReadDataSetType().
|
virtualinherited |
It returns the attribute value in the case of an element node with valid attributes.
name | The attribute name. |
Definition at line 64 of file Reader.cpp.
|
virtual |
It returns the local part of the attribute name for the i-th attribute.
i | The attribute position index. |
Implements te::xml::Reader.
Definition at line 262 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the attribute position.
name | The attribute name. |
Implements te::xml::Reader.
Definition at line 292 of file Reader.cpp.
|
virtual |
It returns the qualified name for the i-th attribute.
i | The attribute position index. |
Implements te::xml::Reader.
Definition at line 272 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the attribute URI of the associated namespace in the case of an element node.
i | The attribute position index. |
Implements te::xml::Reader.
Definition at line 282 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the element data value in the case of VALUE node.
It returns the element data value length in the case of VALUE or CDATA node.
Implements te::xml::Reader.
Definition at line 228 of file Reader.cpp.
|
virtual |
It returns the local part of the element name in the case of an element node.
Implements te::xml::Reader.
Definition at line 213 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the qualified name in the case of an element node.
Implements te::xml::Reader.
Definition at line 218 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the URI of the associated namespace in the case of an element node.
Implements te::xml::Reader.
Definition at line 208 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It returns the element data value in the case of VALUE node.
Implements te::xml::Reader.
Definition at line 223 of file Reader.cpp.
References te::xerces::ToString().
|
virtualinherited |
It returns the element data value in the case of VALUE node.
Definition at line 42 of file Reader.cpp.
Referenced by te::map::serialize::ReadLayerChart(), te::se::serialize::ReadLinePlacement(), and te::se::serialize::ReadShadedRelief().
|
virtualinherited |
It returns the element data value in the case of VALUE node.
Definition at line 37 of file Reader.cpp.
Referenced by te::se::serialize::ReadContrastEnhancement(), te::se::serialize::ReadInterpolationPoint(), te::map::serialize::ReadLayerChart(), te::map::serialize::ReadLayerGrouping(), te::se::serialize::ReadRule(), and te::se::serialize::ReadShadedRelief().
|
virtualinherited |
It returns the element data value in the case of VALUE node.
Definition at line 32 of file Reader.cpp.
References te::xml::Reader::getElementValue().
Referenced by DataSetAdapterLayerReader(), DataSetLayerReader(), te::wms::serialize::LayerReader(), QueryLayerReader(), RasterLayerReader(), te::serialize::xml::ReadGrid(), te::map::serialize::ReadLayerChart(), and te::map::serialize::ReadLayerGrouping().
|
virtual |
Implements te::xml::Reader.
Definition at line 304 of file Reader.cpp.
References te::xerces::ToString().
|
virtual |
It return the type of node read.
Implements te::xml::Reader.
Definition at line 203 of file Reader.cpp.
|
virtual |
It returns the number of attributes in the case of an element node.
Implements te::xml::Reader.
Definition at line 238 of file Reader.cpp.
|
virtual |
Implements te::xml::Reader.
Definition at line 299 of file Reader.cpp.
|
virtual |
It tells if the element has attributes in the case of an element node.
Implements te::xml::Reader.
Definition at line 233 of file Reader.cpp.
|
virtual |
It gets the next event to be read.
Exception | It throws an exception if something goes wrong during the text read. |
Implements te::xml::Reader.
Definition at line 145 of file Reader.cpp.
References te::xml::END_ELEMENT, te::xml::START_ELEMENT, TE_TR, te::xerces::ToString(), te::xml::UNKNOWN, and te::xml::WHITESPACE.
|
virtual |
It prepare the given file to be read.
You must call read to start parsing the XML document.
fileURI | A path to a XML file or any URI where it can be found. |
Exception | It throws an exception if the file doesn't exist or if the internal parser can not read it. |
Implements te::xml::Reader.
Definition at line 104 of file Reader.cpp.
References te::xerces::ErrorHandler::getErrors(), TE_TR, te::xerces::ToString(), and te::xml::UNKNOWN.
void te::xerces::Reader::reset | ( | ) |
It resets the parser.
Exception | It throws an exception if it is not possible to reset the parser. |
Definition at line 317 of file Reader.cpp.
References TE_TR, and te::xerces::ToString().
|
virtual |
If true it caches the grammar in the pool for re-use in subsequent parses.
d | If If true it caches the grammar in the pool for re-use in subsequent parses. |
Implements te::xml::Reader.
Definition at line 94 of file Reader.cpp.
|
virtual |
It enables or disables the parser namespace processing.
d | If true the internal parser will perform the namespace processing otherwise this will not be done. |
Implements te::xml::Reader.
Definition at line 74 of file Reader.cpp.
|
virtual |
It enables or disables the parser schema processing.
d | If true the internal parser will perform the schema processing otherwise this will not be done. |
Implements te::xml::Reader.
Definition at line 79 of file Reader.cpp.
|
virtual |
If true the parser will ignore the white space characters.
d | If true the parser will ignore the white space characters. |
Implements te::xml::Reader.
Definition at line 99 of file Reader.cpp.
|
virtual |
It sets the maximal allowed buffer size used for parsing.
size | The maximal allowed buffer size used for parsing. |
Implements te::xml::Reader.
Definition at line 312 of file Reader.cpp.
|
virtual |
If true the reader will use cached grammar if it exists in the pool.
d | If true the reader will use cached grammar if it exists in the pool. |
Implements te::xml::Reader.
Definition at line 89 of file Reader.cpp.
|
virtual |
If true the parser will perform a validation scheme.
d | If true the parser will perform a validation scheme. |
Implements te::xml::Reader.
Definition at line 84 of file Reader.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |