te::xml::Reader Class Referenceabstract

This class models a XML reader object. More...

#include <Reader.h>

Inheritance diagram for te::xml::Reader:
te::xerces::Reader

Public Member Functions

virtual std::string getAttr (const std::string &name) const =0
 It returns the attribute value in the case of an element node with valid attributes. More...
 
virtual std::string getAttr (std::size_t i) const =0
 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...
 
virtual std::string getAttrLocalName (std::size_t i) const =0
 It returns the local part of the attribute name for the i-th attribute. More...
 
virtual std::size_t getAttrPosition (const std::string &name) const =0
 It returns the attribute position. More...
 
virtual std::string getAttrQName (std::size_t i) const =0
 It returns the qualified name for the i-th attribute. More...
 
virtual std::string getAttrURI (std::size_t i) const =0
 It returns the attribute URI of the associated namespace in the case of an element node. More...
 
virtual std::size_t getElementDataLen () const =0
 It returns the element data value in the case of VALUE node. More...
 
virtual std::string getElementLocalName () const =0
 It returns the local part of the element name in the case of an element node. More...
 
virtual std::string getElementQName () const =0
 It returns the qualified name in the case of an element node. More...
 
virtual std::string getElementURI () const =0
 It returns the URI of the associated namespace in the case of an element node. More...
 
virtual std::string getElementValue () const =0
 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...
 
virtual void getNamespace (std::size_t i, std::pair< std::string, std::string > &ns) const =0
 
virtual NodeType getNodeType () const =0
 It return the type of node read. More...
 
virtual std::size_t getNumberOfAttrs () const =0
 It returns the number of attributes in the case of an element node. More...
 
virtual std::size_t getNumberOfNamespaces () const =0
 
virtual bool hasAttrs () const =0
 It tells if the element has attributes in the case of an element node. More...
 
virtual bool next ()=0
 It gets the next event to be read. More...
 
virtual void read (const std::string &fileURI)=0
 It prepare the given file to be read. More...
 
 Reader ()
 Default constructor. More...
 
virtual void setCacheGrammarFromParse (bool d)=0
 If true it caches the grammar in the pool for re-use in subsequent parses. More...
 
virtual void setDoNamespaces (bool d)=0
 It enables or disables the parser namespace processing. More...
 
virtual void setDoSchema (bool d)=0
 It enables or disables the parser schema processing. More...
 
virtual void setIgnoreWhiteSpaces (bool d)=0
 If true the parser will ignore the white space characters. More...
 
virtual void setInternalBufferSize (const std::size_t size)=0
 It sets the maximal allowed buffer size used for parsing. More...
 
virtual void setUseCachedGrammarInParse (bool d)=0
 If true the reader will use cached grammar if it exists in the pool. More...
 
virtual void setValidationScheme (bool d)=0
 If true the parser will perform a validation scheme. More...
 
virtual ~Reader ()
 Virtual destructor. More...
 

Detailed Description

This class models a XML reader object.

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.

Definition at line 55 of file Reader.h.

Constructor & Destructor Documentation

te::xml::Reader::Reader ( )
inline

Default constructor.

Definition at line 60 of file Reader.h.

virtual te::xml::Reader::~Reader ( )
inlinevirtual

Virtual destructor.

Reimplemented in te::xerces::Reader.

Definition at line 63 of file Reader.h.

Member Function Documentation

virtual std::string te::xml::Reader::getAttr ( const std::string &  name) const
pure virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
nameThe attribute name.
Returns
The attribute value in the case of an element node with valid attributes.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getAttr ( std::size_t  i) const
pure virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
iThe attribute position.
Returns
The attribute value in the case of an element node with valid attributes.

Implemented in te::xerces::Reader.

virtual double te::xml::Reader::getAttrAsDouble ( const std::string &  name) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
nameThe attribute name.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a double.
virtual double te::xml::Reader::getAttrAsDouble ( std::size_t  i) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
iThe attribute position.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a double.
virtual boost::int32_t te::xml::Reader::getAttrAsInt32 ( const std::string &  name) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
nameThe attribute name.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a 32-bit integer.
virtual boost::int32_t te::xml::Reader::getAttrAsInt32 ( std::size_t  i) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
iThe attribute position.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a 32-bit integer.
virtual boost::uint32_t te::xml::Reader::getAttrAsUInt32 ( std::size_t  i) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
iThe attribute position.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a 32-bit unsigned integer.
virtual boost::uint32_t te::xml::Reader::getAttrAsUInt32 ( const std::string  name) const
virtual

It returns the attribute value in the case of an element node with valid attributes.

Parameters
nameThe attribute name.
Returns
The attribute value in the case of an element node with valid attributes.
Note
Just call this method if you know that the attribute value can be converted to a 32-bit unsigned integer.
virtual std::string te::xml::Reader::getAttrLocalName ( std::size_t  i) const
pure virtual

It returns the local part of the attribute name for the i-th attribute.

Parameters
iThe attribute position index.
Returns
The local part of the attribute name in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::size_t te::xml::Reader::getAttrPosition ( const std::string &  name) const
pure virtual

It returns the attribute position.

Parameters
nameThe attribute name.
Returns
The attribute position.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getAttrQName ( std::size_t  i) const
pure virtual

It returns the qualified name for the i-th attribute.

Parameters
iThe attribute position index.
Returns
The qualified attribute name in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getAttrURI ( std::size_t  i) const
pure virtual

It returns the attribute URI of the associated namespace in the case of an element node.

Parameters
iThe attribute position index.
Returns
The attribute URI of the associated namespace in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::size_t te::xml::Reader::getElementDataLen ( ) const
pure virtual

It returns the element data value in the case of VALUE node.

Returns
The element data value in the case of VALUE node.
Note
Just call this method if you know that the element value can be converted to a bool.

It returns the element data value length in the case of VALUE or CDATA node.

Returns
The element data value in the case of VALUE or CDATA node.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getElementLocalName ( ) const
pure virtual

It returns the local part of the element name in the case of an element node.

Returns
The local part of the element name in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getElementQName ( ) const
pure virtual

It returns the qualified name in the case of an element node.

Returns
The qualified name in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getElementURI ( ) const
pure virtual

It returns the URI of the associated namespace in the case of an element node.

Returns
The URI of the associated namespace in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::string te::xml::Reader::getElementValue ( ) const
pure virtual

It returns the element data value in the case of VALUE node.

Returns
The element data value in the case of VALUE node.

Implemented in te::xerces::Reader.

virtual bool te::xml::Reader::getElementValueAsBoolean ( ) const
virtual

It returns the element data value in the case of VALUE node.

Returns
The element data value in the case of VALUE node.
Note
Just call this method if you know that the element value can be converted to a boolean.
virtual double te::xml::Reader::getElementValueAsDouble ( ) const
virtual

It returns the element data value in the case of VALUE node.

Returns
The element data value in the case of VALUE node.
Note
Just call this method if you know that the element value can be converted to a double.
virtual boost::int32_t te::xml::Reader::getElementValueAsInt32 ( ) const
virtual

It returns the element data value in the case of VALUE node.

Returns
The element data value in the case of VALUE node.
Note
Just call this method if you know that the element value can be converted to a 32-bit integer.
virtual void te::xml::Reader::getNamespace ( std::size_t  i,
std::pair< std::string, std::string > &  ns 
) const
pure virtual

Implemented in te::xerces::Reader.

virtual NodeType te::xml::Reader::getNodeType ( ) const
pure virtual

It return the type of node read.

Returns
The type of node read.

Implemented in te::xerces::Reader.

virtual std::size_t te::xml::Reader::getNumberOfAttrs ( ) const
pure virtual

It returns the number of attributes in the case of an element node.

Returns
The number of attributes in the case of an element node.

Implemented in te::xerces::Reader.

virtual std::size_t te::xml::Reader::getNumberOfNamespaces ( ) const
pure virtual

Implemented in te::xerces::Reader.

virtual bool te::xml::Reader::hasAttrs ( ) const
pure virtual

It tells if the element has attributes in the case of an element node.

Returns
True if the element has attributes in the case of an element node, otherwise, false.

Implemented in te::xerces::Reader.

virtual bool te::xml::Reader::next ( )
pure virtual

It gets the next event to be read.

Returns
True if an event was read otherwise false.
Exceptions
ExceptionIt throws an exception if something goes wrong during the text read.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::read ( const std::string &  fileURI)
pure virtual

It prepare the given file to be read.

You must call read to start parsing the XML document.

Parameters
fileURIA path to a XML file or any URI where it can be found.
Exceptions
ExceptionIt throws an exception if the file doesn't exist or if the internal parser can not read it.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setCacheGrammarFromParse ( bool  d)
pure virtual

If true it caches the grammar in the pool for re-use in subsequent parses.

Parameters
dIf If true it caches the grammar in the pool for re-use in subsequent parses.
Note
By default the reader is set to cache the grammar.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setDoNamespaces ( bool  d)
pure virtual

It enables or disables the parser namespace processing.

Parameters
dIf true the internal parser will perform the namespace processing otherwise this will not be done.
Note
By default the reader is set to do namespace processing.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setDoSchema ( bool  d)
pure virtual

It enables or disables the parser schema processing.

Parameters
dIf true the internal parser will perform the schema processing otherwise this will not be done.
Note
If set to true the namespace processing must also be turned on.
By default the reader is set to parser schema.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setIgnoreWhiteSpaces ( bool  d)
pure virtual

If true the parser will ignore the white space characters.

Parameters
dIf true the parser will ignore the white space characters.
Note
By default the reader is set to consider white spaces.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setInternalBufferSize ( const std::size_t  size)
pure virtual

It sets the maximal allowed buffer size used for parsing.

Parameters
sizeThe maximal allowed buffer size used for parsing.
Note
Default: 65536 bytes (64 kbytes), see the macro TE_XML_READER_MAX_BUFFSIZE.
The default value may be implementation dependent!

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setUseCachedGrammarInParse ( bool  d)
pure virtual

If true the reader will use cached grammar if it exists in the pool.

Parameters
dIf true the reader will use cached grammar if it exists in the pool.
Note
By default the reader is set to use cached grammar.

Implemented in te::xerces::Reader.

virtual void te::xml::Reader::setValidationScheme ( bool  d)
pure virtual

If true the parser will perform a validation scheme.

Parameters
dIf true the parser will perform a validation scheme.
Note
By default the reader is set to validate the scheme.

Implemented in te::xerces::Reader.


The documentation for this class was generated from the following file: