libcommonc++
0.7
|
An object representing an XML document. More...
#include <XMLDocument.h++>
Public Member Functions | |
XMLDocument () | |
Construct a new XMLDocument. More... | |
~XMLDocument () | |
Destructor. More... | |
XMLElement & | getRoot () |
Get the root element of the document. More... | |
const XMLElement & | getRoot () const |
Get the root element of the document. More... | |
XMLElement & | setRoot (const String &name) |
Set the root element of the document. More... | |
XMLElement & | find (const String &path) |
Find an XML element via a path. More... | |
const XMLElement & | find (const String &path) const |
Find an XML element via a path. More... | |
void | read (std::istream &stream) |
Read and parse the XML document from a stream. More... | |
void | read (const String &str) |
Read and parse the XML document from a String. More... | |
void | write (std::ostream &stream, uint_t tabWidth=2) const |
Format and write the XML document to a stream. More... | |
void | write (String &str, uint_t tabWidth=2) const |
Format and write the XML document to a String. More... | |
bool | isEmpty () const |
Test if the document is empty. More... | |
bool | operator! () const |
Test if the document is empty. More... | |
An object representing an XML document.
XMLDocument | ( | ) |
Construct a new XMLDocument.
~XMLDocument | ( | ) |
Destructor.
XMLElement & find | ( | const String & | path | ) |
Find an XML element via a path.
path | The path, a dot- or slash-separated list of element names beginning with the root element. |
InvalidArgumentException | If the path contains invalid element names. |
const XMLElement & find | ( | const String & | path | ) | const |
Find an XML element via a path.
path | The path, a dot- or slash-separated list of element names beginning with the root element. |
InvalidArgumentException | If the path contains invalid element names. |
XMLElement & getRoot | ( | ) |
Get the root element of the document.
const XMLElement & getRoot | ( | ) | const |
Get the root element of the document.
|
inline |
Test if the document is empty.
|
inline |
Test if the document is empty.
void read | ( | std::istream & | stream | ) |
Read and parse the XML document from a stream.
stream | The stream to read from. |
ParseException | If a parse error occurs. |
IOException | If an I/O error occurs. |
void read | ( | const String & | str | ) |
Read and parse the XML document from a String.
str | The String to read from. |
ParseException | If a parse error occurs. |
XMLElement & setRoot | ( | const String & | name | ) |
Set the root element of the document.
The previous content of the document is deleted.
name | The name for the new element. |
InvalidArgumentException | If the name is invalid. |
void write | ( | std::ostream & | stream, |
uint_t | tabWidth = 2 |
||
) | const |
Format and write the XML document to a stream.
stream | The stream to write to. |
tabWidth | The tab width for indentation; a value of 0 disables pretty-printing. |
IOException | If an I/O error occurs. |