Yate
|
Xml Document. More...
#include <yatexml.h>
Public Member Functions | |
XmlDocument () | |
virtual | ~XmlDocument () |
virtual XmlDocument * | document () |
virtual XmlSaxParser::Error | addChild (XmlChild *child) |
XmlDeclaration * | declaration () const |
XmlElement * | root (bool completed=false) const |
virtual void | reset () |
virtual XmlChild * | removeChild (XmlChild *child, bool delObj=true) |
virtual XmlSaxParser::Error | read (Stream &in, int *error=0) |
virtual int | write (Stream &out, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty(), bool completeOnly=true) const |
XmlSaxParser::Error | loadFile (const char *file, int *error=0) |
int | saveFile (const char *file=0, bool escape=true, const String &indent=String::empty(), bool completeOnly=true) const |
void | toString (String &dump, bool escape=true, const String &indent=String::empty(), const String &origIndent=String::empty()) const |
Xml Document.
Xml Document
XmlDocument | ( | ) |
The Constructor
virtual ~XmlDocument | ( | ) | [virtual] |
Destructor
Append a new child to this document. Set the root to an XML element if not already set. If we already have a completed root the element will be added to the root, otherwise an error will be returned. If we don't have a root non xml elements (other then text) will be added the list of elements before root
child | The child to append |
Implements XmlParent.
XmlDeclaration* declaration | ( | ) | const |
Retrieve the document declaration
virtual XmlDocument* document | ( | ) | [inline, virtual] |
Get an Xml Document
Reimplemented from XmlParent.
Referenced by XmlDomParser::document().
XmlSaxParser::Error loadFile | ( | const char * | file, |
int * | error = 0 |
||
) |
Load a file an parse it Reset the document
file | The file to load |
error | Pointer to data to be filled with file error if IOError is returned |
Load this document from data stream and parse it.
in | The input stream |
error | Optional pointer to data to be filled with error if IOError is returned |
virtual XmlChild* removeChild | ( | XmlChild * | child, |
bool | delObj = true |
||
) | [inline, virtual] |
XmlElement* root | ( | bool | completed = false | ) | const |
Retrieve the root element
completed | True to retrieve the root element if is not completed |
int saveFile | ( | const char * | file = 0 , |
bool | escape = true , |
||
const String & | indent = String::empty() , |
||
bool | completeOnly = true |
||
) | const |
Save this xml document in the specified file. Create a new fle if not found. Truncate an existing one
file | The file to save or will be used the file used on load |
escape | True if the attributes values need to be escaped |
indent | Spaces for output |
completeOnly | True to build only if complete |
void toString | ( | String & | dump, |
bool | escape = true , |
||
const String & | indent = String::empty() , |
||
const String & | origIndent = String::empty() |
||
) | const |
Build a String from this XmlDocument
dump | The string where to append representation |
escape | True if the attributes values need to be escaped |
indent | Spaces for output |
origIndent | Original indent |
virtual int write | ( | Stream & | out, |
bool | escape = true , |
||
const String & | indent = String::empty() , |
||
const String & | origIndent = String::empty() , |
||
bool | completeOnly = true |
||
) | const [virtual] |
Write this document to a data stream. A indent + n * origIndent will be added before each xml child, where n is the imbrication level, starting with 0. A indent + (n + 1) * origIndent will be added before each attribute
out | The output stream |
escape | True if the attributes values need to be escaped |
indent | Line indent |
origIndent | Original indent |
completeOnly | True to build only if complete |