Download NHK English news podcast automatically. This application requires mpod mother board. See also http://mbed.org/users/geodenx/notebook/mpod/
Dependencies: BlinkLed HTTPClient EthernetInterface FatFileSystemCpp MSCFileSystem mbed-rtos mbed
XMLDocument Class Reference
A Document binds together all the functionality. More...
#include <tinyxml2.h>
Inherits tinyxml2::XMLNode.
Public Member Functions | |
XMLDocument (bool processEntities=true) | |
constructor | |
virtual XMLDocument * | ToDocument () |
Safely cast to a Document, or null. | |
int | Parse (const char *xml) |
Parse an XML file from a character string. | |
int | LoadFile (const char *filename) |
Load an XML file from disk. | |
int | LoadFile (FILE *) |
Load an XML file from disk. | |
int | SaveFile (const char *filename) |
Save the XML file to disk. | |
int | SaveFile (FILE *) |
Save the XML file to disk. | |
bool | HasBOM () const |
Returns true if this document has a leading Byte Order Mark of UTF8. | |
void | SetBOM (bool useBOM) |
Sets whether to write the BOM when writing the file. | |
XMLElement * | RootElement () |
Return the root element of DOM. | |
void | Print (XMLPrinter *streamer=0) |
Print the Document. | |
virtual bool | Accept (XMLVisitor *visitor) const |
Accept a hierarchical visit of the nodes in the TinyXML DOM. | |
XMLElement * | NewElement (const char *name) |
Create a new Element associated with this Document. | |
XMLComment * | NewComment (const char *comment) |
Create a new Comment associated with this Document. | |
XMLText * | NewText (const char *text) |
Create a new Text associated with this Document. | |
XMLDeclaration * | NewDeclaration (const char *text=0) |
Create a new Declaration associated with this Document. | |
XMLUnknown * | NewUnknown (const char *text) |
Create a new Unknown associated with this Document. | |
void | DeleteNode (XMLNode *node) |
Delete a node associated with this document. | |
bool | Error () const |
Return true if there was an error parsing the document. | |
int | ErrorID () const |
Return the errorID. | |
const char * | GetErrorStr1 () const |
Return a possibly helpful diagnostic location or string. | |
const char * | GetErrorStr2 () const |
Return a possibly helpful secondary diagnostic location or string. | |
void | PrintError () const |
If there is an error, print it to stdout. | |
virtual XMLNode * | ShallowClone (XMLDocument *) const |
Make a copy of this node, but not its children. | |
virtual bool | ShallowEqual (const XMLNode *) const |
Test if 2 nodes are the same, but don't test children. | |
const XMLDocument * | GetDocument () const |
Get the XMLDocument that owns this XMLNode. | |
XMLDocument * | GetDocument () |
Get the XMLDocument that owns this XMLNode. | |
virtual XMLElement * | ToElement () |
Safely cast to an Element, or null. | |
virtual XMLText * | ToText () |
Safely cast to Text, or null. | |
virtual XMLComment * | ToComment () |
Safely cast to a Comment, or null. | |
virtual XMLDeclaration * | ToDeclaration () |
Safely cast to a Declaration, or null. | |
virtual XMLUnknown * | ToUnknown () |
Safely cast to an Unknown, or null. | |
const char * | Value () const |
The meaning of 'value' changes for the specific type. | |
void | SetValue (const char *val, bool staticMem=false) |
Set the Value of an XML node. | |
const XMLNode * | Parent () const |
Get the parent of this node on the DOM. | |
bool | NoChildren () const |
Returns true if this node has no children. | |
const XMLNode * | FirstChild () const |
Get the first child node, or null if none exists. | |
const XMLElement * | FirstChildElement (const char *value=0) const |
Get the first child element, or optionally the first child element with the specified name. | |
const XMLNode * | LastChild () const |
Get the last child node, or null if none exists. | |
const XMLElement * | LastChildElement (const char *value=0) const |
Get the last child element or optionally the last child element with the specified name. | |
const XMLNode * | PreviousSibling () const |
Get the previous (left) sibling node of this node. | |
const XMLElement * | PreviousSiblingElement (const char *value=0) const |
Get the previous (left) sibling element of this node, with an opitionally supplied name. | |
const XMLNode * | NextSibling () const |
Get the next (right) sibling node of this node. | |
const XMLElement * | NextSiblingElement (const char *value=0) const |
Get the next (right) sibling element of this node, with an opitionally supplied name. | |
XMLNode * | InsertEndChild (XMLNode *addThis) |
Add a child node as the last (right) child. | |
XMLNode * | InsertFirstChild (XMLNode *addThis) |
Add a child node as the first (left) child. | |
XMLNode * | InsertAfterChild (XMLNode *afterThis, XMLNode *addThis) |
Add a node after the specified child node. | |
void | DeleteChildren () |
Delete all the children of this node. | |
void | DeleteChild (XMLNode *node) |
Delete a child of this node. |
Detailed Description
A Document binds together all the functionality.
It can be saved, loaded, and printed to the screen. All Nodes are connected and allocated to a Document. If the Document is deleted, all its Nodes are also deleted.
Definition at line 1042 of file tinyxml2.h.
Constructor & Destructor Documentation
XMLDocument | ( | bool | processEntities = true ) |
constructor
Definition at line 1420 of file tinyxml2.cpp.
Member Function Documentation
bool Accept | ( | XMLVisitor * | visitor ) | const [virtual] |
Accept a hierarchical visit of the nodes in the TinyXML DOM.
Every node in the XML tree will be conditionally visited and the host will be called back via the TiXmlVisitor interface.
This is essentially a SAX interface for TinyXML. (Note however it doesn't re-parse the XML for the callbacks, so the performance of TinyXML is unchanged by using this interface versus any other.)
The interface has been based on ideas from:
Which are both good references for "visiting".
An example of using Accept():
TiXmlPrinter printer; tinyxmlDoc.Accept( &printer ); const char* xmlcstr = printer.CStr();
Implements XMLNode.
Definition at line 528 of file tinyxml2.cpp.
void DeleteChild | ( | XMLNode * | node ) | [inherited] |
Delete a child of this node.
Definition at line 601 of file tinyxml2.cpp.
void DeleteChildren | ( | ) | [inherited] |
Delete all the children of this node.
Definition at line 571 of file tinyxml2.cpp.
void DeleteNode | ( | XMLNode * | node ) |
Delete a node associated with this document.
It will be unlinked from the DOM.
Definition at line 1166 of file tinyxml2.h.
bool Error | ( | ) | const |
Return true if there was an error parsing the document.
Definition at line 1171 of file tinyxml2.h.
int ErrorID | ( | ) | const |
Return the errorID.
Definition at line 1173 of file tinyxml2.h.
const XMLNode* FirstChild | ( | ) | const [inherited] |
Get the first child node, or null if none exists.
Definition at line 484 of file tinyxml2.h.
const XMLElement * FirstChildElement | ( | const char * | value = 0 ) |
const [inherited] |
Get the first child element, or optionally the first child element with the specified name.
Definition at line 676 of file tinyxml2.cpp.
const XMLDocument* GetDocument | ( | ) | const [inherited] |
Get the XMLDocument that owns this XMLNode.
Definition at line 443 of file tinyxml2.h.
XMLDocument* GetDocument | ( | ) | [inherited] |
Get the XMLDocument that owns this XMLNode.
Definition at line 445 of file tinyxml2.h.
const char* GetErrorStr1 | ( | ) | const |
Return a possibly helpful diagnostic location or string.
Definition at line 1175 of file tinyxml2.h.
const char* GetErrorStr2 | ( | ) | const |
Return a possibly helpful secondary diagnostic location or string.
Definition at line 1177 of file tinyxml2.h.
bool HasBOM | ( | ) | const |
Returns true if this document has a leading Byte Order Mark of UTF8.
Definition at line 1097 of file tinyxml2.h.
Add a node after the specified child node.
Definition at line 655 of file tinyxml2.cpp.
Add a child node as the last (right) child.
Definition at line 608 of file tinyxml2.cpp.
Add a child node as the first (left) child.
Definition at line 631 of file tinyxml2.cpp.
const XMLNode* LastChild | ( | ) | const [inherited] |
Get the last child node, or null if none exists.
Definition at line 493 of file tinyxml2.h.
const XMLElement * LastChildElement | ( | const char * | value = 0 ) |
const [inherited] |
Get the last child element or optionally the last child element with the specified name.
Definition at line 690 of file tinyxml2.cpp.
int LoadFile | ( | FILE * | fp ) |
Load an XML file from disk.
You are responsible for providing and closing the FILE*.
Returns XML_NO_ERROR (0) on success, or an errorID.
Definition at line 1532 of file tinyxml2.cpp.
int LoadFile | ( | const char * | filename ) |
Load an XML file from disk.
Returns XML_NO_ERROR (0) on success, or an errorID.
Definition at line 1509 of file tinyxml2.cpp.
XMLComment * NewComment | ( | const char * | comment ) |
Create a new Comment associated with this Document.
The memory for the Comment is managed by the Document.
Definition at line 1473 of file tinyxml2.cpp.
XMLDeclaration * NewDeclaration | ( | const char * | text = 0 ) |
Create a new Declaration associated with this Document.
The memory for the object is managed by the Document.
If the 'text' param is null, the standard declaration is used.:
<?xml version="1.0" encoding="UTF-8"?>
Definition at line 1491 of file tinyxml2.cpp.
XMLElement * NewElement | ( | const char * | name ) |
Create a new Element associated with this Document.
The memory for the Element is managed by the Document.
Definition at line 1464 of file tinyxml2.cpp.
XMLText * NewText | ( | const char * | text ) |
Create a new Text associated with this Document.
The memory for the Text is managed by the Document.
Definition at line 1482 of file tinyxml2.cpp.
XMLUnknown * NewUnknown | ( | const char * | text ) |
Create a new Unknown associated with this Document.
The memory for the object is managed by the Document.
Definition at line 1500 of file tinyxml2.cpp.
const XMLNode* NextSibling | ( | ) | const [inherited] |
Get the next (right) sibling node of this node.
Definition at line 511 of file tinyxml2.h.
const XMLElement * NextSiblingElement | ( | const char * | value = 0 ) |
const [inherited] |
Get the next (right) sibling element of this node, with an opitionally supplied name.
Definition at line 704 of file tinyxml2.cpp.
bool NoChildren | ( | ) | const [inherited] |
Returns true if this node has no children.
Definition at line 481 of file tinyxml2.h.
const XMLNode* Parent | ( | ) | const [inherited] |
Get the parent of this node on the DOM.
Definition at line 477 of file tinyxml2.h.
int Parse | ( | const char * | xml ) |
Parse an XML file from a character string.
Returns XML_NO_ERROR (0) on success, or an errorID.
Definition at line 1595 of file tinyxml2.cpp.
const XMLNode* PreviousSibling | ( | ) | const [inherited] |
Get the previous (left) sibling node of this node.
Definition at line 503 of file tinyxml2.h.
const XMLElement * PreviousSiblingElement | ( | const char * | value = 0 ) |
const [inherited] |
Get the previous (left) sibling element of this node, with an opitionally supplied name.
Definition at line 717 of file tinyxml2.cpp.
void Print | ( | XMLPrinter * | streamer = 0 ) |
Print the Document.
If the Printer is not provided, it will print to stdout. If you provide Printer, this can print to a file:
XMLPrinter printer( fp ); doc.Print( &printer );
Or you can use a printer to print to memory:
XMLPrinter printer; doc->Print( &printer ); // printer.CStr() has a const char* to the XML
Definition at line 1621 of file tinyxml2.cpp.
void PrintError | ( | ) | const |
If there is an error, print it to stdout.
Definition at line 1638 of file tinyxml2.cpp.
XMLElement* RootElement | ( | ) |
Return the root element of DOM.
Equivalent to FirstChildElement(). To get the first node, use FirstChild().
Definition at line 1105 of file tinyxml2.h.
int SaveFile | ( | const char * | filename ) |
Save the XML file to disk.
Returns XML_NO_ERROR (0) on success, or an errorID.
Definition at line 1567 of file tinyxml2.cpp.
int SaveFile | ( | FILE * | fp ) |
Save the XML file to disk.
You are responsible for providing and closing the FILE*.
Returns XML_NO_ERROR (0) on success, or an errorID.
Definition at line 1587 of file tinyxml2.cpp.
void SetBOM | ( | bool | useBOM ) |
Sets whether to write the BOM when writing the file.
Definition at line 1100 of file tinyxml2.h.
void SetValue | ( | const char * | val, |
bool | staticMem = false |
||
) | [inherited] |
virtual XMLNode* ShallowClone | ( | XMLDocument * | document ) | const [virtual] |
Make a copy of this node, but not its children.
You may pass in a Document pointer that will be the owner of the new Node. If the 'document' is null, then the node returned will be allocated from the current Document. (this->GetDocument())
Note: if called on a XMLDocument, this will return null.
Implements XMLNode.
Definition at line 1184 of file tinyxml2.h.
virtual bool ShallowEqual | ( | const XMLNode * | compare ) | const [virtual] |
Test if 2 nodes are the same, but don't test children.
The 2 nodes do not need to be in the same Document.
Note: if called on a XMLDocument, this will return false.
Implements XMLNode.
Definition at line 1185 of file tinyxml2.h.
virtual XMLComment* ToComment | ( | ) | [virtual, inherited] |
Safely cast to a Comment, or null.
Reimplemented in XMLComment.
Definition at line 449 of file tinyxml2.h.
virtual XMLDeclaration* ToDeclaration | ( | ) | [virtual, inherited] |
Safely cast to a Declaration, or null.
Reimplemented in XMLDeclaration.
Definition at line 451 of file tinyxml2.h.
virtual XMLDocument* ToDocument | ( | ) | [virtual] |
Safely cast to a Document, or null.
Reimplemented from XMLNode.
Definition at line 1050 of file tinyxml2.h.
virtual XMLElement* ToElement | ( | ) | [virtual, inherited] |
Safely cast to an Element, or null.
Reimplemented in XMLElement.
Definition at line 447 of file tinyxml2.h.
virtual XMLText* ToText | ( | ) | [virtual, inherited] |
virtual XMLUnknown* ToUnknown | ( | ) | [virtual, inherited] |
Safely cast to an Unknown, or null.
Reimplemented in XMLUnknown.
Definition at line 452 of file tinyxml2.h.
const char* Value | ( | ) | const [inherited] |
The meaning of 'value' changes for the specific type.
Document: empty Element: name of the element Comment: the comment text Unknown: the tag contents Text: the text string
Definition at line 470 of file tinyxml2.h.
Generated on Wed Jul 13 2022 10:38:55 by 1.7.2