Public Member Functions | |
XmlNode & | addAttribute (const XmlAttribute &attribute) |
Adds an attribute to the XmlNode and returns the node. | |
XmlNode & | addChild (const SmartUtil::tstring &name, const SmartUtil::tstring &content, const SmartUtil::tstring &nameSpace) |
Adds a child to the children list and returns a reference to that child. | |
XmlNode & | addNamespace (const XmlNamespace &nameSpace) |
Adds a namespace to the XmlNode. | |
attribute_iterator | attributes_begin () |
begin of attributes | |
attribute_iterator | attributes_end () |
end of attributes | |
node_iterator | children_begin () |
begin of children iterator | |
node_iterator | children_end () |
end of children iterator | |
size_t | children_size () const |
Returns the number of generation one children the node has. | |
SmartUtil::tstring | findAttribute (const SmartUtil::tstring &name) const |
Returns the value of the attribute with the given name. | |
const XmlAttribute * | findAttributeComplete (const SmartUtil::tstring &name, const SmartUtil::tstring &nameSpace) const |
Returns the attribute with the given name. | |
XmlAttribute * | findAttributeComplete (const SmartUtil::tstring &name, const SmartUtil::tstring &nameSpace) |
Returns the attribute with the given name. | |
const XmlAttribute * | findAttributeComplete (const SmartUtil::tstring &name) const |
Returns the attribute with the given name. | |
XmlAttribute * | findAttributeComplete (const SmartUtil::tstring &name) |
Returns the attribute with the given name. | |
const SmartUtil::tstring | getContent () const |
Returns the human readable content of the XML node, throws if node does not allow for content, e.g. have child nodes. | |
std::vector< unsigned int > | getDNACode () const |
Returns a vector of integers defining the "DNA" code of the Node, see http://www.geocities.com/polterguy1000/ for a thorough explenation. | |
const SmartUtil::tstring & | getName () const |
Returns the name of the XML node. | |
const SmartUtil::tstring & | getNamespace () const |
Returns the namespace of the attribute. | |
const SmartUtil::tstring & | getNamespaceAlias () const |
Returns the namespace of the XML node. | |
XmlNode * | getParent () |
Returns the parent node. | |
namespace_iterator | namespaces_begin () |
begin of namespaces in node | |
namespace_iterator | namespaces_end () |
end of namespaces in node | |
XmlNode & | operator[] (size_t idx) |
Subscript operator returning the n'th children node. | |
XmlNode & | setContent (const SmartUtil::tstring &content) |
Sets the content of the XmlNode. | |
XmlNode & | setName (const SmartUtil::tstring &name) |
Sets the name of the XmlNode. | |
XmlNode & | setNamespace (const SmartUtil::tstring &nameSpace) |
Sets the namespace of the XmlNode. | |
Friends | |
std::basic_ostream< TCHAR > & | operator<< (std::basic_ostream< TCHAR > &, const XmlDocument &writer) |
An XML document can be written to any ostream through usage of the insertion operator (<<). |
All interaction (deletion, adding and so on) of an XML document is been done through this class. Though you must have an XML document to have an XML node this class can be seen as the "heart" of the SmartXML library!
SmartUtil::tstring findAttribute | ( | const SmartUtil::tstring & | name | ) | const |
Returns the value of the attribute with the given name.
Note that one attribute may have two attributes with the same name existing in the same namespace, this function will just return the FIRST attribute it finds with the given name. If you need to filter on the namespace in addition then use the findAttributeComplete function that takes the namespace in addition instead!
const XmlAttribute * findAttributeComplete | ( | const SmartUtil::tstring & | name, | |
const SmartUtil::tstring & | nameSpace | |||
) | const |
Returns the attribute with the given name.
This one searches for the given attribute filtering on both name and the given namespace. Note that the namespace given here is NOT the "alias" but the COMPLETE namespace, meaning if you have a namespace that looks like this: xmlns:myNs="thomas hansen" you should supply "thomas hansen" as the nameSpace and NOT the "myNs"... It will recursively look upwards in the DOM until it finds the namespace for the attribute meaning it might take some time to finish!
XmlAttribute * findAttributeComplete | ( | const SmartUtil::tstring & | name, | |
const SmartUtil::tstring & | nameSpace | |||
) |
Returns the attribute with the given name.
This one searches for the given attribute filtering on both name and the given namespace. Note that the namespace given here is NOT the "alias" but the COMPLETE namespace, meaning if you have a namespace that looks like this: xmlns:myNs="thomas hansen" you should supply "thomas hansen" as the nameSpace and NOT the "myNs"... It will recursively look upwards in the DOM until it finds the namespace for the attribute meaning it might take some time to finish!
const XmlAttribute * findAttributeComplete | ( | const SmartUtil::tstring & | name | ) | const |
Returns the attribute with the given name.
This one just returns the FIRST attribute it finds with the given name! This means there MIGHT be problems regarding to attributes with the same name existing in different namespaces, to play safe you would want to look for namespace with a given name AND existing in a given namespace! Though this one is included for really simple XML documents due to that it's way more speedy!!
XmlAttribute * findAttributeComplete | ( | const SmartUtil::tstring & | name | ) |
Returns the attribute with the given name.
This one just returns the FIRST attribute it finds with the given name! This means there MIGHT be problems regarding to attributes with the same name existing in different namespaces, to play safe you would want to look for namespace with a given name AND existing in a given namespace! Though this one is included for really simple XML documents due to that it's way more speedy!!
std::vector< unsigned int > getDNACode | ( | ) | const |
Returns a vector of integers defining the "DNA" code of the Node, see http://www.geocities.com/polterguy1000/ for a thorough explenation.
Useful for doing "vector" math on nodes in a DOM document. You can calculate order by doing a comparison of the DNA codes of two different nodes, you can calculate distance to document node, you can calculate minimum number of sibblings to all ancestors etc. Also you can store a "pointer" to a node and use for later retrieving that same node as long as there has not been inserted nodes at any of its ancestors "earlier" in the hierarchy. You can also use the DNA code to exactly calculate the placement of the node in the hierarchy. Basically a "Genetic Tree" is an easy way to describe a graph in a linear form.