xmlm::BasicDocument< T > Class Template Reference

An XML document. More...

#include <xmlminus.h>

List of all members.

Public Types

typedef T string_type
 The string type.
typedef T::value_type char_type
 The character type of the string type.
typedef T::traits_type traits_type
 The char traits type of the string type.
typedef std::basic_istream<
char_type, traits_type
istream_type
 An input stream type to use with this type of element.
typedef std::basic_ostream<
char_type, traits_type
ostream_type
 An input output type to use with this type of element.
typedef std::vector< BasicElement<
T > > 
ChildVector
 A vector of elements.

Public Member Functions

 BasicDocument (istream_type &in)
 Create and parse a new XML document.
 BasicDocument (istream_type &in, const std::locale &loc)
 Create and parse a new XML document.
 BasicDocument (const std::string &filename)
 Create and parse a new XML element from a file.
 BasicDocument (const std::string &filename, const std::locale &loc)
 Create and parse a new XML element from a file.
 BasicDocument (const std::locale &locale)
 Create a new document with one empty element.
 BasicDocument ()
 Create a new document with one empty element.
std::locale & getLocale ()
 Get this document's locale.
const std::locale & getLocale () const
 Get this document's locale.
BasicElement< T > & getRootElement ()
 Get this document's root element.
const BasicElement< T > & getRootElement () const
 Get this document's root element.
const ChildVectorgetChildren () const
 Get this document's child elements.
ChildVectorgetChildren ()
 Get this document's child elements.
void parse (istream_type &in)
 Read and parse this document from a stream.
void print (ostream_type &out) const
 Write this document to an output stream.


Detailed Description

template<class T>
class xmlm::BasicDocument< T >

An XML document.

Parameters:
T the string type for this document


Constructor & Destructor Documentation

template<class T>
xmlm::BasicDocument< T >::BasicDocument ( istream_type in  )  [inline]

Create and parse a new XML document.

This document's locale will be queried from the input stream.

Parameters:
in the input stream where to read the XML data
Exceptions:
ParseError on parsing/syntax errors
std::runtime_error on I/O errors

template<class T>
xmlm::BasicDocument< T >::BasicDocument ( istream_type in,
const std::locale &  loc 
) [inline]

Create and parse a new XML document.

The locale will be imbue'd to the input stream and the previous locale will be restored after the parsing.

Parameters:
in the input stream where to read the XML
loc the locale to use
Exceptions:
ParseError on parsing/syntax errors
std::runtime_error on I/O errors

template<class T>
xmlm::BasicDocument< T >::BasicDocument ( const std::string &  filename  )  [inline]

Create and parse a new XML element from a file.

This document's locale will be queried from the input stream.

Parameters:
filename the filename of the file from where to read the XML
Exceptions:
ParseError on parsing/syntax errors
std::runtime_error on I/O errors

template<class T>
xmlm::BasicDocument< T >::BasicDocument ( const std::string &  filename,
const std::locale &  loc 
) [inline]

Create and parse a new XML element from a file.

The locale will be imbue'd to the input stream and the previous locale will be restored after the parsing.

Parameters:
filename the filename of the file from where to read the XML
loc the locale to use
Exceptions:
ParseError on parsing/syntax errors
std::runtime_error on I/O errors

template<class T>
xmlm::BasicDocument< T >::BasicDocument ( const std::locale &  locale  )  [inline]

Create a new document with one empty element.

Parameters:
locale the locale to use


Member Function Documentation

template<class T>
std::locale& xmlm::BasicDocument< T >::getLocale (  )  [inline]

Get this document's locale.

Returns:
this document's locale

template<class T>
const std::locale& xmlm::BasicDocument< T >::getLocale (  )  const [inline]

Get this document's locale.

Returns:
this document's locale

template<class T>
BasicElement<T>& xmlm::BasicDocument< T >::getRootElement (  )  [inline]

Get this document's root element.

Returns:
a reference to this document's root element
Exceptions:
ParseError if there's no root element in this document

template<class T>
const BasicElement<T>& xmlm::BasicDocument< T >::getRootElement (  )  const [inline]

Get this document's root element.

Returns:
a reference to this document's root element
Exceptions:
ParseError if there's no root element in this document

template<class T>
const ChildVector& xmlm::BasicDocument< T >::getChildren (  )  const [inline]

Get this document's child elements.

Returns:
a vector that has this document's all child elements

template<class T>
ChildVector& xmlm::BasicDocument< T >::getChildren (  )  [inline]

Get this document's child elements.

Returns:
a vector that has this document's all child elements

template<class T>
void xmlm::BasicDocument< T >::parse ( istream_type in  ) 

Read and parse this document from a stream.

Parameters:
in the input stream where to parse this document from
Exceptions:
ParseError on parsing errors
std::runtime_error on I/O errors

template<class T>
void xmlm::BasicDocument< T >::print ( ostream_type out  )  const

Write this document to an output stream.

Writes out this element and all it's subelements recursively.

Parameters:
out the output stream where to write this element


The documentation for this class was generated from the following file:
Generated on Fri Dec 15 19:24:38 2006 for XMLminus by  doxygen 1.5.0