#include <document.h>
Public Types | |
typedef std::size_t | size_type |
size type | |
Public Member Functions | |
document (void) | |
Create a new XML document with the default settings. | |
document (const char *root_name) | |
Create a new XML document and set the name of the root element to the given text. | |
document (const node &n) | |
Create a new XML document and set the root node. | |
document (const document &other) | |
Copy construct a new XML document. | |
document & | operator= (const document &other) |
Copy another document object into this one using the assignment operator. | |
void | swap (document &other) |
Swap one xml::document object for another. | |
~document (void) | |
Clean up after an XML document object. | |
const node & | get_root_node (void) const |
Get a reference to the root node of this document. | |
node & | get_root_node (void) |
Get a reference to the root node of this document. | |
void | set_root_node (const node &n) |
Set the root node to the given node. | |
const std::string & | get_version (void) const |
Get the XML version for this document. | |
void | set_version (const char *version) |
Set the XML version number for this document. | |
const std::string & | get_encoding (void) const |
Get the XML encoding for this document. | |
void | set_encoding (const char *encoding) |
Set the XML encoding string. | |
bool | get_is_standalone (void) const |
Find out if the current document is a standalone document. | |
void | set_is_standalone (bool sa) |
Set the standalone flag. | |
bool | process_xinclude (void) |
Walk through the document and expand <xi:include> elements. | |
bool | has_internal_subset (void) const |
Test to see if this document has an internal subset. | |
bool | has_external_subset (void) const |
Test to see if this document has an external subset. | |
bool | validate (void) |
Validate this document against the DTD that has been attached to it. | |
bool | validate (const char *dtdname) |
Parse the given DTD and try to validate this document against it. | |
size_type | size (void) const |
Returns the number of child nodes of this document. | |
node::iterator | begin (void) |
Get an iterator to the first child node of this document. | |
node::const_iterator | begin (void) const |
Get a const_iterator to the first child node of this document. | |
node::iterator | end (void) |
Get an iterator that points one past the last child node for this document. | |
node::const_iterator | end (void) const |
Get a const_iterator that points one past the last child node for this document. | |
void | push_back (const node &child) |
Add a child xml::node to this document. | |
node::iterator | insert (const node &n) |
Insert a new child node. | |
node::iterator | insert (node::iterator position, const node &n) |
Insert a new child node. | |
node::iterator | replace (node::iterator old_node, const node &new_node) |
Replace the node pointed to by the given iterator with another node. | |
node::iterator | erase (node::iterator to_erase) |
Erase the node that is pointed to by the given iterator. | |
node::iterator | erase (node::iterator first, node::iterator last) |
Erase all nodes in the given range, from frist to last. | |
void | save_to_string (std::string &s) const |
Convert the XML document tree into XML text data and place it into the given string. | |
bool | save_to_file (const char *filename, int compression_level=0) const |
Convert the XML document tree into XML text data and place it into the given filename. | |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const document &doc) |
Convert the XML document tree into XML text data and then insert it into the given stream. |
|
size type
|
|
Create a new XML document with the default settings. The new document will contain a root node with a name of "blank".
|
|
Create a new XML document and set the name of the root element to the given text.
|
|
Create a new XML document and set the root node.
|
|
Copy construct a new XML document. The new document will be an exact copy of the original.
|
|
Clean up after an XML document object.
|
|
Get a const_iterator to the first child node of this document. If what you really wanted was the root node (the first element) you should use the get_root_node() member function instead.
|
|
Get an iterator to the first child node of this document. If what you really wanted was the root node (the first element) you should use the get_root_node() member function instead.
|
|
Get a const_iterator that points one past the last child node for this document.
|
|
Get an iterator that points one past the last child node for this document.
|
|
Erase all nodes in the given range, from frist to last. This will invalidate any iterators that point to the nodes to be erased, or any pointers or references to those nodes. Do not remove the root node using this member function. The same rules that apply to push_back apply here. If you try to erase the root node, an exception will be thrown.
|
|
Erase the node that is pointed to by the given iterator. The node and all its children will be removed from this node. This will invalidate any iterators that point to the node to be erased, or any pointers or references to that node. Do not remove the root node using this member function. The same rules that apply to push_back apply here. If you try to erase the root node, an exception will be thrown.
|
|
Get the XML encoding for this document. The default encoding is ISO-8859-1.
|
|
Find out if the current document is a standalone document. For generated documents, this will be the default. For parsed documents this will be set based on the XML processing instruction.
|
|
Get a reference to the root node of this document. If no root node has been set, the returned node will be a blank node. You should take caution to use a reference so that you don't copy the whole node tree!
|
|
Get a reference to the root node of this document. If no root node has been set, the returned node will be a blank node. You should take caution to use a reference so that you don't copy the whole node tree!
|
|
Get the XML version for this document. For generated documents, the version will be the default. For parsed documents, this will be the version from the XML processing instruction.
|
|
Test to see if this document has an external subset. That is, it references a DTD from an external source, such as a file or URL.
|
|
Test to see if this document has an internal subset. That is, DTD data that is declared within the XML document itself.
|
|
Insert a new child node. The new node will be inserted before the node pointed to by the given iterator. The rules from the push_back member function apply here. Don't add a node of type element.
|
|
Insert a new child node. The new node will be inserted at the end of the child list. This is similar to the xml::node::push_back member function except that an iterator to the inserted node is returned. The rules from the push_back member function apply here. Don't add a node of type element.
|
|
Copy another document object into this one using the assignment operator. This document object will be an exact copy of the other document after the assignement.
|
|
Walk through the document and expand <xi:include> elements. For more information, please see the w3c recomendation for XInclude. http://www.w3.org/2001/XInclude. The return value of this function may change to int after a bug has been fixed in libxml2 (xmlXIncludeDoProcess).
|
|
Add a child xml::node to this document. You should not add a element type node, since there can only be one root node. This member function is only useful for adding processing instructions, comments, etc.. If you do try to add a node of type element, an exception will be thrown.
|
|
Replace the node pointed to by the given iterator with another node. The old node will be removed, including all its children, and replaced with the new node. This will invalidate any iterators that point to the node to be replaced, or any pointers or references to that node. Do not replace this root node with this member function. The same rules that apply to push_back apply here. If you try to replace a node of type element, an exception will be thrown.
|
|
Convert the XML document tree into XML text data and place it into the given filename.
|
|
Convert the XML document tree into XML text data and place it into the given string.
|
|
Set the XML encoding string. If you don't set this, it will default to ISO-8859-1.
|
|
Set the standalone flag. This will show up in the XML output in the correct processing instruction.
|
|
Set the root node to the given node. A full copy is made and stored in the document object.
|
|
Set the XML version number for this document. This version string will be used when generating the XML output.
|
|
Returns the number of child nodes of this document. This will always be at least one, since all xmlwrapp documents must have a root node. This member function is useful to find out how many document children there are, including processing instructions, comments, etc.
|
|
Swap one xml::document object for another.
|
|
Parse the given DTD and try to validate this document against it. If the DTD is valid, and the document is valid, this member function will return true. If it returns false, you may want to send the document through xmllint to get the actual error messages. This member function will add the parsed DTD to this document as the external subset after the validation. If there is already an external DTD attached to this document it will be removed and deleted.
|
|
Validate this document against the DTD that has been attached to it. This would happen at parse time if there was a !DOCTYPE definition. If the DTD is valid, and the document is valid, this member function will return true. If it returns false, you may want to send the document through xmllint to get the actual error messages.
|
|
Convert the XML document tree into XML text data and then insert it into the given stream.
|