XML Library
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
XML::Reader Class Reference

The reader to create an XML document from a text stream. More...

#include <Reader.hpp>

List of all members.

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< NodePtrNodeStack
 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 &)
Readeroperator= (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.

Detailed Description

The reader to create an XML document from a text stream.


Member Typedef Documentation

typedef std::stack<NodePtr> XML::Reader::NodeStack [private]

A stack of XML nodes.


Member Enumeration Documentation

The readingflags.

Enumerator:
DEFAULT 

Default flags.

DISCARD_WHITESPACE 

Discard whitespace-only text nodes.

DISCARD_COMMENTS 

Discard comment nodes.

DISCARD_PROC_INSTNS 

Discard processing instructions.

DISCARD_DOC_TYPES 

Discard document type declarations.


Constructor & Destructor Documentation

Default constructor.

Destructor.

XML::Reader::Reader ( const Reader ) [private]

Member Function Documentation

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.

Reader& XML::Reader::operator= ( const Reader  ) [private]

Member Data Documentation

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.

The stack of unclosed element nodes.


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