XML Library
|
The reader to create an XML document from a text stream. More...
#include <Reader.hpp>
Public Types | |
enum | Flag { DEFAULT = 0x0000, DISCARD_WHITESPACE = 0x0001, DISCARD_COMMENTS = 0x0002, DISCARD_PROC_INSTNS = 0x0004, DISCARD_DOC_TYPES = 0x0008 } |
The readingflags. More... | |
Public Member Functions | |
Reader () | |
Default constructor. | |
~Reader () | |
Destructor. | |
DocumentPtr | readDocument (const tchar *pcBegin, const tchar *pcEnd, uint nFlags=DEFAULT) |
Read a document from a pair of raw string pointers. | |
DocumentPtr | readDocument (const tstring &str, uint nFlags=DEFAULT) |
Read a document from a string. | |
Private Types | |
typedef std::stack< NodePtr > | NodeStack |
A stack of XML nodes. | |
Private Member Functions | |
void | initialise (const tchar *pcBegin, const tchar *pcEnd, uint nFlags) |
Initialise the internal state ready for reading. | |
void | readCommentTag (const tchar *pcNodeBegin) |
Read and parse a comment tag. | |
void | readProcessingTag (const tchar *pcNodeBegin) |
Read and parse a processing instruction tag. | |
void | readTextNode (const tchar *pcNodeBegin) |
Read and create a text node. | |
void | readElementTag (const tchar *pcNodeBegin) |
Read and parse an element tag. | |
void | readDocTypeTag (const tchar *pcNodeBegin) |
Read and parse a document type tag. | |
void | readCDataSection (const tchar *pcNodeBegin) |
Read and parse CDATA section. | |
const tchar * | readIdentifier (const tchar *pcBegin, const tchar *pcEnd, tstring &strIdentifier) |
Read an identifier. | |
const tchar * | readAttribute (const tchar *pcBegin, const tchar *pcEnd, tstring &strName, tstring &strValue) |
Read an attribute. | |
Reader (const Reader &) | |
Reader & | operator= (const Reader) |
Private Attributes | |
const tchar * | m_pcBegin |
The start of the text stream. | |
const tchar * | m_pcEnd |
The end of the text stream. | |
const tchar * | m_pcCurrent |
The current position in the stream. | |
uint | m_nFlags |
The flags to control reading. | |
NodeStack | m_oNodeStack |
The stack of unclosed element nodes. |
The reader to create an XML document from a text stream.
typedef std::stack<NodePtr> XML::Reader::NodeStack [private] |
A stack of XML nodes.
enum XML::Reader::Flag |
Default constructor.
Destructor.
XML::Reader::Reader | ( | const Reader & | ) | [private] |
DocumentPtr XML::Reader::readDocument | ( | const tchar * | pcBegin, |
const tchar * | pcEnd, | ||
uint | nFlags = DEFAULT |
||
) |
Read a document from a pair of raw string pointers.
DocumentPtr XML::Reader::readDocument | ( | const tstring & | str, |
uint | nFlags = DEFAULT |
||
) | [inline] |
Read a document from a string.
void XML::Reader::initialise | ( | const tchar * | pcBegin, |
const tchar * | pcEnd, | ||
uint | nFlags | ||
) | [private] |
Initialise the internal state ready for reading.
void XML::Reader::readCommentTag | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and parse a comment tag.
void XML::Reader::readProcessingTag | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and parse a processing instruction tag.
void XML::Reader::readTextNode | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and create a text node.
void XML::Reader::readElementTag | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and parse an element tag.
If the tag is a start tag or empty tag an element node is returned. If it's a close tag, no node is returned.
void XML::Reader::readDocTypeTag | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and parse a document type tag.
void XML::Reader::readCDataSection | ( | const tchar * | pcNodeBegin | ) | [private] |
Read and parse CDATA section.
const tchar * XML::Reader::readIdentifier | ( | const tchar * | pcBegin, |
const tchar * | pcEnd, | ||
tstring & | strIdentifier | ||
) | [private] |
Read an identifier.
const tchar * XML::Reader::readAttribute | ( | const tchar * | pcBegin, |
const tchar * | pcEnd, | ||
tstring & | strName, | ||
tstring & | strValue | ||
) | [private] |
Read an attribute.
The reads both the name and value.
const tchar* XML::Reader::m_pcBegin [private] |
The start of the text stream.
const tchar* XML::Reader::m_pcEnd [private] |
The end of the text stream.
const tchar* XML::Reader::m_pcCurrent [private] |
The current position in the stream.
uint XML::Reader::m_nFlags [private] |
The flags to control reading.
NodeStack XML::Reader::m_oNodeStack [private] |
The stack of unclosed element nodes.