MezzanineEngine March 18, 2012

Mezzanine::xml::Node Class Reference

A light-weight handle for manipulating nodes in DOM tree. More...

#include <xmldoc.h>

Inheritance diagram for Mezzanine::xml::Node:
Mezzanine::xml::Document

List of all members.

Public Types

typedef AttributeIterator attribute_iterator
 An iterator for Attribute members on this Node.
typedef NodeIterator iterator
 An iterator for child Nodes.

Public Member Functions

 Node ()
 Default constructor. Constructs an empty node.
 Node (NodeStruct *p)
 Constructs node from internal pointer.
Attribute AppendAttribute (const char_t *Name)
 Creates an Attribute and puts it at the end of this Nodes attributes.
Attribute AppendAttribute (const String &Name)
 Creates an Attribute and puts it at the end of this Nodes attributes.
Node AppendChild (NodeType Type=NodeElement)
 Creates a Node and makes it a child of this one.
Node AppendChild (const char_t *Name)
 Creates an element Node as a child of this Node, with the given name.
Node AppendChild (const String &Name)
 Creates an element Node as a child of this Node, with the given name.
Attribute AppendCopy (const Attribute &proto)
 Copies an Attribute and puts the copy at the end of this Nodes attributes.
Node AppendCopy (const Node &proto)
 Copies a Node and puts the copy at the end of the list of this Nodes Childrem.
attribute_iterator attributes_begin () const
 Get an Attribute iterator that references the first Attribute on this Node.
attribute_iterator attributes_end () const
 Get an Attribute iterator that references the one past the last Attribute on this Node.
iterator begin () const
 Get a Child node iterator that references the first child Node.
const char_tChildValue () const
 Retrieve the value of this(or a child's) Nodes PCDATA child Node.
const char_tChildValue (const char_t *Name) const
 Get the PCDATA of a given child. The same a calling "GetChild(Name).ChildValue()".
bool Empty () const
 Is this storing anything at all?
iterator end () const
 Get a Child node iterator that references one past the last child Node.
template<typename Predicate >
Attribute FindAttribute (Predicate pred) const
 Search for an Attribute using a function to check each Attribute individually.
template<typename Predicate >
Node FindChild (Predicate pred) const
 Search for an child ( only direct children ) Node using a function to check each Node individually.
Node FindChildbyAttribute (const char_t *AttrName, const char_t *AttrValue) const
 Find a Node by an Attribute it has.
Node FindChildbyAttribute (const char_t *Name, const char_t *AttrName, const char_t *AttrValue) const
 Find a Node by an Attribute it has.
template<typename Predicate >
Node FindNode (Predicate pred) const
 Search for any Node descended from this Node using a function to check each Node individually.
XPathNodeSet FindNodes (const char_t *query, XPathVariableSet *variables=0) const
 Select a group of nodes by evaluating an XPath query.
XPathNodeSet FindNodes (const XPathQuery &query) const
 Select a group of nodes by evaluating an XPath query.
XPathNode FindSingleNode (const XPathQuery &query) const
 Select single node by evaluating an XPath query. Returns first node from the resulting node set.
XPathNode FindSingleNode (const char_t *query, XPathVariableSet *variables=0) const
 Select single node by evaluating an XPath query. Returns first node from the resulting node set.
Node FirstElementByPath (const char_t *Path, char_t delimiter= '/') const
 Search for a node by Path consisting of node names and . or .. elements.
Attribute GetAttribute (const char_t *Name) const
 Attempt to get an Attribute on this Node with a given name.
Node GetChild (const char_t *Name) const
 Attempt to get a child Node with a given name.
Node GetChild (const String &Name) const
 Attempt to get a child Node with a given name.
Attribute GetFirstAttribute () const
 Get the First Attribute in this Node.
Node GetFirstChild () const
 Get the first child Node of this Node.
Attribute GetLastAttribute () const
 Get the Last Attribute in this Node.
Node GetLastChild () const
 Get the last child Node of this Node.
Node GetNextSibling () const
 Attempt to retrieve the next sibling of this Node.
Node GetNextSibling (const char_t *Name) const
 Attempt to retrieve the next sibling of this Node with a matching name.
Node GetParent () const
 Attempt to retrieve the parent of this Node.
Node GetPreviousSibling () const
 Attempt to retrieve the previous sibling of this Node.
Node GetPreviousSibling (const char_t *Name) const
 Attempt to retrieve the first previous sibling of this Node with a matching name.
Node GetRoot () const
 Attempt to retrieve the root Node, or the most base Node containing this Node.
size_t HashValue () const
 Get hash Value (unique for handles to the same object)
Attribute InsertAttributeAfter (const char_t *Name, const Attribute &attr)
 Creates an Attribute and puts it into the list of this Nodes attributes.
Attribute InsertAttributeBefore (const char_t *Name, const Attribute &attr)
 Creates an Attribute and puts it into the list of this Nodes attributes.
Node InsertChildAfter (NodeType Type, const Node &node)
 Creates a Node and makes it a child of this one, and puts at the middle of the Child Nodes.
Node InsertChildAfter (const char_t *Name, const Node &node)
 Creates an element Node as a child of this Node, with the given name at the middle of the children.
Node InsertChildBefore (NodeType Type, const Node &node)
 Creates a Node and makes it a child of this one, and puts at the middle of the Child Nodes.
Node InsertChildBefore (const char_t *Name, const Node &node)
 Creates an element Node as a child of this Node, with the given name at the middle of the children.
Attribute InsertCopyAfter (const Attribute &proto, const Attribute &attr)
 Copies an Attribute and puts the copy into the list of this Nodes attributes.
Node InsertCopyAfter (const Node &proto, const Node &node)
 Copies a Node and puts the copy in the middle the list of this Nodes Childrem.
Node InsertCopyBefore (const Node &proto, const Node &node)
 Copies a Node and puts the copy in the middle the list of this Nodes Childrem.
Attribute InsertCopyBefore (const Attribute &proto, const Attribute &attr)
 Copies an Attribute and puts the copy into the list of this Nodes attributes.
NodeStructInternalObject () const
 Get internal pointer.
const char_tName () const
 Get the name of this Node.
ptrdiff_t OffSetDebug () const
 Get node Offset in parsed file/string (in char_t units) for debugging purposes.
 operator unspecified_bool_type () const
 Used to convert this to a boolean value in a safe way.
bool operator! () const
 Used to convert this node the opposite of it's normal boolean value.
bool operator!= (const Node &r) const
 Compares the internal values to check inequality.
bool operator< (const Node &r) const
 Compares the internal values to check for inequality.
bool operator<= (const Node &r) const
 Compares the internal values to check for inequality.
bool operator== (const Node &r) const
 Compares the internal values to check equality.
bool operator> (const Node &r) const
 Compares the internal values to check for inequality.
bool operator>= (const Node &r) const
 Compares the internal values to check for inequality.
String Path (char_t delimiter= '/') const
 Get the absolute path to this Node.
Attribute PrependAttribute (const char_t *Name)
 Creates an Attribute and puts it at the begining of this Nodes attributes.
Node PrependChild (const String &Name)
 Creates an element Node as a child of this Node, with the given name at the beginning of the children.
Node PrependChild (NodeType Type=NodeElement)
 Creates a Node and makes it a child of this one, and puts at the beginning of the Child Nodes.
Node PrependChild (const char_t *Name)
 Creates an element Node as a child of this Node, with the given name at the beginning of the children.
Node PrependCopy (const Node &proto)
 Copies a Node and puts the copy at the start of the list of this Nodes Childrem.
Attribute PrependCopy (const Attribute &proto)
 Copies an Attribute and puts the copy at the beginning of this Nodes attributes.
void Print (std::basic_ostream< char, std::char_traits< char > > &os, const char_t *indent=XML_TEXT("\t"), unsigned int flags=FormatDefault, Encoding DocumentEncoding=EncodingAuto, unsigned int Depth=0) const
 Output the XML document using a Output Stream.
void Print (Writer &WriterInstance, const char_t *indent=XML_TEXT("\t"), unsigned int flags=FormatDefault, Encoding DocumentEncoding=EncodingAuto, unsigned int Depth=0) const
 Output the XML document using a Writer.
void Print (std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &os, const char_t *indent=XML_TEXT("\t"), unsigned int flags=FormatDefault, unsigned int Depth=0) const
 Output the XML document using a Output Stream.
bool RemoveAttribute (const Attribute &a)
 Remove specified Attribute.
bool RemoveAttribute (const char_t *Name)
 Remove Attribute as specified by name.
bool RemoveChild (const Node &n)
 Remove specified child element.
bool RemoveChild (const char_t *Name)
 Remove child element as specified by name.
bool SetName (const char_t *rhs)
 Set the name of .
bool SetName (const String &rhs)
 Set the name of this object.
bool SetValue (const char_t *rhs)
 Set the value of this.
bool Traverse (TreeWalker &walker)
 Perform sophisticated (or whatever) algorithms on this and all descendant Nodes in the XML tree.
NodeType Type () const
 Identify what kind of Node this is.
const char_tValue () const
 Get the Value of this Node.

Protected Types

typedef NodeStruct *Node:: unspecified_bool_type
 Used when testing an Attribute as a bool.

Protected Attributes

NodeStruct_GetRoot
 Stores pointers to the Node data and some metadata.

Friends

class AttributeIterator
class NodeIterator

Detailed Description

A light-weight handle for manipulating nodes in DOM tree.

Definition at line 476 of file xml.h.


Constructor & Destructor Documentation

Mezzanine::xml::Node::Node ( NodeStruct p) [explicit]

Constructs node from internal pointer.

Parameters:
pAn internal node pointer.

Member Function Documentation

Attribute Mezzanine::xml::Node::AppendAttribute ( const char_t Name)

Creates an Attribute and puts it at the end of this Nodes attributes.

Parameters:
NameThe name of the New attribute to be created

This attempts to create an Attribute and stick it at the end of the list of attribute on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Attribute Mezzanine::xml::Node::AppendAttribute ( const String Name) [inline]

Creates an Attribute and puts it at the end of this Nodes attributes.

Parameters:
NameThe name of the New attribute to be created
Returns:
The created Attribute or an empty Attribute on Failure.

Definition at line 600 of file xml.h.

Node Mezzanine::xml::Node::AppendChild ( NodeType  Type = NodeElement)

Creates a Node and makes it a child of this one.

Parameters:
TypeThe NodeType of the Node to be added to list of child Nodes.
Returns:
A Node representing the freshly added Node, or an empty Node if there was an error.
Node Mezzanine::xml::Node::AppendChild ( const char_t Name)

Creates an element Node as a child of this Node, with the given name.

Parameters:
NameThe name of the Node to be created.

Calls Node::AppendChild(NodeType); using NodeElement as the NodeType.

Returns:
The desired Node on success, an empty Node on failure.
Node Mezzanine::xml::Node::AppendChild ( const String Name) [inline]

Creates an element Node as a child of this Node, with the given name.

Parameters:
NameThe name of the Node to be created.

Calls Node::AppendChild(const char_t*)

Returns:
The desired Node on success, an empty Node on failure.

Definition at line 658 of file xml.h.

Attribute Mezzanine::xml::Node::AppendCopy ( const Attribute proto)

Copies an Attribute and puts the copy at the end of this Nodes attributes.

Parameters:
protoThe attribute to be copied.

This attempts to create a copy of an attribute Attribute and stick it at the end of the list of attribute on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Node Mezzanine::xml::Node::AppendCopy ( const Node proto)

Copies a Node and puts the copy at the end of the list of this Nodes Childrem.

Parameters:
protoThe Node to be copied. If this is emptry, no work is performed.
Returns:
The copied Node on success, an empty Node on failure.
Mezzanine::xml::Node::attributes_begin ( ) const

Get an Attribute iterator that references the first Attribute on this Node.

Returns:
A Node::Iterator that reference the first child node.
Mezzanine::xml::Node::attributes_end ( ) const

Get an Attribute iterator that references the one past the last Attribute on this Node.

Returns:
A Node::Iterator that reference the last Attribute on this Node.
Mezzanine::xml::Node::begin ( ) const

Get a Child node iterator that references the first child Node.

Returns:
A Node::Iterator that reference the first child Node.
Mezzanine::xml::Node::ChildValue ( ) const

Retrieve the value of this(or a child's) Nodes PCDATA child Node.

If this node represents "<node>Some text in the PCDATA field, that is actually represent by a node</node>", then this would return "Some text in the PCDATA field, that is actually represent by a node". This will iterate through child Nodes from until it finds a PCDATA node or fails

Returns:
This will return the Value of the first available PCDATA node.
Mezzanine::xml::Node::ChildValue ( const char_t Name) const

Get the PCDATA of a given child. The same a calling "GetChild(Name).ChildValue()".

Parameters:
NameThe Name of the desired child node.
Returns:
This will return the Value of the first available matching PCDATA node.
Mezzanine::xml::Node::Empty ( ) const

Is this storing anything at all?

Returns:
Returns True if this Node is storing nothing. False if it is storing anything.
Mezzanine::xml::Node::end ( ) const

Get a Child node iterator that references one past the last child Node.

Returns:
A Node::Iterator that reference the last child Node.
template<typename Predicate >
Attribute Mezzanine::xml::Node::FindAttribute ( Predicate  pred) const [inline]

Search for an Attribute using a function to check each Attribute individually.

Parameters:
preda pointer to a function that accepts an Attribute, and returns bool.

This iterates through each Attribute on this node, from begining to end and calls the Predicate function passing an Attribute to it. If the Predicate returns true the Node it was just passed is returned. If Precdicate never returns true, it is called on every Node and a blank Node is returned. The Predicate is never called with a null value.

Returns:
This returns the first Attribute that causes Predicate to return true.

Definition at line 724 of file xml.h.

template<typename Predicate >
Node Mezzanine::xml::Node::FindChild ( Predicate  pred) const [inline]

Search for an child ( only direct children ) Node using a function to check each Node individually.

Parameters:
preda pointer to a function that accepts an Node, and returns bool.

This iterates through all immediate children of this Node and calls the Predicate function passing a Node to it. If the Predicate returns true the Node it was just passed is returned. If Predicate never returns true, it is called on every Node and a blank Node is returned. The Predicate is never called with a null value.

Returns:
This returns the first Node that causes Predicate to return true.

Definition at line 742 of file xml.h.

Mezzanine::xml::Node::FindChildbyAttribute ( const char_t Name,
const char_t AttrName,
const char_t AttrValue 
) const

Find a Node by an Attribute it has.

Parameters:
NameThe name of the matching Node.
AttrNameThe name of the matching Attribute.
AttrValueThe value of the matching Attribute.

Any Null pointers instead of character arrays passed in will cause undefined behavior. All Matching is Case sensitive.

Returns:
The First matching xml::Node
Node Mezzanine::xml::Node::FindChildbyAttribute ( const char_t AttrName,
const char_t AttrValue 
) const

Find a Node by an Attribute it has.

Parameters:
AttrNameThe name of the matching Attribute.
AttrValueThe value of the matching Attribute.

Any Null pointers instead of character arrays passed in will cause undefined behavior. All Matching is Case sensitive.

Returns:
The First matching xml::Node
template<typename Predicate >
Node Mezzanine::xml::Node::FindNode ( Predicate  pred) const [inline]

Search for any Node descended from this Node using a function to check each Node individually.

Parameters:
preda pointer to a function that accepts an Node, and returns bool.

This iterates through all children of this Node, and their children ( and so on), and calls the Predicate function passing each Node to it. This iterates through all Nodes using a depth first algorithm. If the Predicate returns true the Node it was just passed is returned. If Predicate never returns true, it is called on every Node and a blank Node is returned. The Predicate is never called with a null value.

Returns:
This returns the first Node that causes Predicate to return true.

Definition at line 760 of file xml.h.

XPathNodeSet Mezzanine::xml::Node::FindNodes ( const char_t query,
XPathVariableSet variables = 0 
) const

Select a group of nodes by evaluating an XPath query.

Parameters:
queryThe XPath query as a c-string to be evaluated.
variablesundocumented.
Returns:
An XPathNodeSet with the Matchs of the XPath query.
XPathNodeSet Mezzanine::xml::Node::FindNodes ( const XPathQuery query) const

Select a group of nodes by evaluating an XPath query.

Parameters:
queryThe XPath query XPathQuery class instance.
Returns:
An XPathNodeSet with the Matchs of the XPath query.
Parameters:
queryThe XPath query XPathQuery class instance.
Mezzanine::xml::Node::FindSingleNode ( const XPathQuery query) const

Select single node by evaluating an XPath query. Returns first node from the resulting node set.

Parameters:
queryThe XPath query XPathQuery class instance.
Returns:
XPathNode The first matching XPath node.
Mezzanine::xml::Node::FindSingleNode ( const char_t query,
XPathVariableSet variables = 0 
) const

Select single node by evaluating an XPath query. Returns first node from the resulting node set.

Parameters:
queryThe XPath query as a c-string to be evaluated.
variablesundocumented.
Returns:
XPathNode The first matching XPath node.
Mezzanine::xml::Node::FirstElementByPath ( const char_t Path,
char_t  delimiter = '/' 
) const

Search for a node by Path consisting of node names and . or .. elements.

Todo:
Investigate this more deeply.
Parameters:
PathThe path to search for.
delimiterThe character to use as a pathname separator, this defaults to '/'.
Returns:
The matching Node, of an empty Node on failure.
Mezzanine::xml::Node::GetAttribute ( const char_t Name) const

Attempt to get an Attribute on this Node with a given name.

Parameters:
NameThe name of the desired Attribute.
Returns:
An Attribute that represents the first matching Attribute, or an empty Attribute on failure.
Node Mezzanine::xml::Node::GetChild ( const char_t Name) const

Attempt to get a child Node with a given name.

Parameters:
NameThe name of the desired child Node.
Returns:
A Node that represents the first desired child, or an empty Node on failure.
Node Mezzanine::xml::Node::GetChild ( const String Name) const [inline]

Attempt to get a child Node with a given name.

Parameters:
NameThe name of the desired child Node.
Returns:
A Node that represents the first desired child, or an empty Node on failure.

Definition at line 550 of file xml.h.

Mezzanine::xml::Node::GetFirstAttribute ( ) const

Get the First Attribute in this Node.

Returns:
This attempts to return the First Attribute in this node, if it cannot it returns an empty Attribute.
Mezzanine::xml::Node::GetFirstChild ( ) const

Get the first child Node of this Node.

Returns:
Returns the First child node if it exists, otherwise it return an empty node.
Mezzanine::xml::Node::GetLastAttribute ( ) const

Get the Last Attribute in this Node.

Returns:
This attempts to return the Last Attribute in this node, if it cannot it returns an empty Attribute.
Mezzanine::xml::Node::GetLastChild ( ) const

Get the last child Node of this Node.

Returns:
Returns the last child node if it exists, otherwise it return an empty node.
Mezzanine::xml::Node::GetNextSibling ( ) const

Attempt to retrieve the next sibling of this Node.

A sibling of a Node is another Node that shares the same parent. If this is and the sibling nodes are valid, this retrieves that Node, otherwise this return an empty Node.

Returns:
A Node that represents a sibling, or an empty Node on failure.
Node Mezzanine::xml::Node::GetNextSibling ( const char_t Name) const

Attempt to retrieve the next sibling of this Node with a matching name.

Parameters:
NameA c-string that has the name of the node you to find.

A sibling of a Node is another Node that shares the same parent. If this is and the sibling nodes are valid, this iterates through Nodes until a sibling with a Matching name is found or all siblings are checked. If a Match is found this retrieves that Node, otherwise this return an empty Node.

Returns:
A Node that represents a sibling with a matching name, or an empty Node on failure.
Mezzanine::xml::Node::GetParent ( ) const

Attempt to retrieve the parent of this Node.

Returns:
A Node that represents the parent Node, or an empty Node on failure.
Node Mezzanine::xml::Node::GetPreviousSibling ( ) const

Attempt to retrieve the previous sibling of this Node.

A sibling of a Node is another Node that shares the same parent. If this is and the sibling nodes are valid, this retrieves that Node, otherwise this return an empty Node.

Returns:
A Node that represents a sibling, or an empty Node on failure.
Node Mezzanine::xml::Node::GetPreviousSibling ( const char_t Name) const

Attempt to retrieve the first previous sibling of this Node with a matching name.

Parameters:
NameA c-string that has the name of the node you to find.

A sibling of a Node is another Node that shares the same parent. If this is and the sibling nodes are valid, this iterates through Nodes until a sibling with a Matching name is found or all siblings are checked. If a Match is found this retrieves that Node, otherwise this return an empty Node.

Returns:
A Node that represents a sibling with a matching name, or an empty Node on failure.
Mezzanine::xml::Node::GetRoot ( ) const

Attempt to retrieve the root Node, or the most base Node containing this Node.

Returns:
A Node that represents the root of the XML document, or an empty Node on failure. If there are multiple roots this attempts to retrieve the appropriate one.
Mezzanine::xml::Node::HashValue ( ) const

Get hash Value (unique for handles to the same object)

Returns:
ptrdiff_t
A size_t that uniquely identifies this node.
Mezzanine::xml::Node::InsertAttributeAfter ( const char_t Name,
const Attribute attr 
)

Creates an Attribute and puts it into the list of this Nodes attributes.

Parameters:
NameThe name of the New attribute to be created
attrAn Attribute that represents an Attribute on this Node, and is just before where you want the new Attribute.

This attempts to create an Attribute and stick it in the list of attributes, Just after another Attribute, on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Mezzanine::xml::Node::InsertAttributeBefore ( const char_t Name,
const Attribute attr 
)

Creates an Attribute and puts it into the list of this Nodes attributes.

Parameters:
NameThe name of the New attribute to be created
attrAn Attribute that represents an Attribute on this Node, and is just after where you want the new Attribute.

This attempts to create an Attribute and stick it in the list of attributes, Just before another Attribute, on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Mezzanine::xml::Node::InsertChildAfter ( NodeType  Type,
const Node node 
)

Creates a Node and makes it a child of this one, and puts at the middle of the Child Nodes.

Todo:
Not all nodes can be added to other nodes, we need to figure it out and put it here.
Parameters:
TypeThe NodeType of the Node to be added, just after another specific node.
nodeThe specific node to add the new one after.
Todo:
Not all nodes can be added to other nodes, we need to figure it out and put it here.
Returns:
A Node representing the freshly added Node, or an empty Node if there was an error.
Node Mezzanine::xml::Node::InsertChildAfter ( const char_t Name,
const Node node 
)

Creates an element Node as a child of this Node, with the given name at the middle of the children.

Parameters:
NameThe name of the Node to be created.
nodeThe node just before were the Create node is to be placed.

Calls Node::InsertChildAfter(NodeType, Node); using NodeElement as the NodeType.

Returns:
The desired Node on success, an empty Node on failure.
Node Mezzanine::xml::Node::InsertChildBefore ( NodeType  Type,
const Node node 
)

Creates a Node and makes it a child of this one, and puts at the middle of the Child Nodes.

Parameters:
TypeThe NodeType of the Node to be added, just before another specific node.
nodeThe specific node to add the new one before.
Returns:
A Node representing the freshly added Node, or an empty Node if there was an error.
Todo:
Not all nodes can be added to other nodes, we need to figure it out and put it here.
Node Mezzanine::xml::Node::InsertChildBefore ( const char_t Name,
const Node node 
)

Creates an element Node as a child of this Node, with the given name at the middle of the children.

Parameters:
NameThe name of the Node to be created.
nodeThe node just after were the Create node is to be placed.

Calls Node::InsertChildBefore(NodeType, Node); using NodeElement as the NodeType.

Returns:
The desired Node on success, an empty Node on failure.
Attribute Mezzanine::xml::Node::InsertCopyAfter ( const Attribute proto,
const Attribute attr 
)

Copies an Attribute and puts the copy into the list of this Nodes attributes.

Parameters:
protoThe attribute to be copied.
attrAn Attribute that represents an Attribute on this Node, and is just before where you want the new copy of proto.

This attempts to create a copy of an attribute Attribute and stick it in the middle of the list of attributes, just after a selected attribute, on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Node Mezzanine::xml::Node::InsertCopyAfter ( const Node proto,
const Node node 
)

Copies a Node and puts the copy in the middle the list of this Nodes Childrem.

Parameters:
protoThe Node to be copied. If this is emptry, no work is performed.
nodeThe Node just before the desired place in the list of children to insert the copied node.
Returns:
The copied Node on success, an empty Node on failure.
Mezzanine::xml::Node::InsertCopyBefore ( const Attribute proto,
const Attribute attr 
)

Copies an Attribute and puts the copy into the list of this Nodes attributes.

Parameters:
protoThe attribute to be copied.
attrAn Attribute that represents an Attribute on this Node, and is just after where you want the new copy of proto.

This attempts to create a copy of an attribute Attribute and stick it in the middle of the list of attributes, just before a selected attribute, on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Node Mezzanine::xml::Node::InsertCopyBefore ( const Node proto,
const Node node 
)

Copies a Node and puts the copy in the middle the list of this Nodes Childrem.

Parameters:
protoThe Node to be copied. If this is emptry, no work is performed.
nodeThe Node just after the desired place in the list of children to insert the copied node.
Returns:
The copied Node on success, an empty Node on failure.
Mezzanine::xml::Node::InternalObject ( ) const

Get internal pointer.

Returns:
A NodeStruct* that points to the internal data of this Node
Mezzanine::xml::Node::Name ( ) const

Get the name of this Node.

Returns:
Returns A pointer to a const c-style array of the the character type (usually char or wchar_t) containing the name.
Warning:
returns "" if Node is empty.
Mezzanine::xml::Node::operator unspecified_bool_type ( ) const

Used to convert this to a boolean value in a safe way.

Returns:
Returns true if the internal data is set and false otherwise.
Mezzanine::xml::Node::operator! ( ) const

Used to convert this node the opposite of it's normal boolean value.

This is described in the PugiXML source a a workaround for a borland c++ issue.

Returns:
Returns false if the internal pointer NodeStruct is set and true otherwise.
Mezzanine::xml::Node::operator!= ( const Node r) const

Compares the internal values to check inequality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns true if any of the internal values don't match between this and the other Node.
Mezzanine::xml::Node::operator< ( const Node r) const

Compares the internal values to check for inequality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns True if the other Node is greater than this one as per sequential comparison of internal pointers.
Mezzanine::xml::Node::operator<= ( const Node r) const

Compares the internal values to check for inequality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns True if the other Node is greater than or equal to this one as per sequential comparison of internal pointers.
Mezzanine::xml::Node::operator== ( const Node r) const

Compares the internal values to check equality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns true if all the internal values match between this and the other Node.
Mezzanine::xml::Node::operator> ( const Node r) const

Compares the internal values to check for inequality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns True if the other Node is less than this one as per sequential comparison of internal pointers.
Mezzanine::xml::Node::operator>= ( const Node r) const

Compares the internal values to check for inequality.

Parameters:
rThe other Node this is being compared to.

Many of the internal values are pointers, and it is the addresses of these that are being compared.

Returns:
Returns True if the other Node is less than or equal to this one as per sequential comparison of internal pointers.
Mezzanine::xml::Node::Path ( char_t  delimiter = '/') const

Get the absolute path to this Node.

Parameters:
delimiterThe character to use as a pathname separator, this defaults to '/'.
Returns:
A String containing an path
Mezzanine::xml::Node::PrependAttribute ( const char_t Name)

Creates an Attribute and puts it at the begining of this Nodes attributes.

Parameters:
NameThe name of the New attribute to be created

This attempts to create an Attribute and stick it at the beginning of the list of attributes on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
Node Mezzanine::xml::Node::PrependChild ( const String Name) [inline]

Creates an element Node as a child of this Node, with the given name at the beginning of the children.

Parameters:
NameThe name of the Node to be created.

Calls Node::PrependChild(const char_t*);

Returns:
The desired Node on success, an empty Node on failure.

Definition at line 669 of file xml.h.

Mezzanine::xml::Node::PrependChild ( NodeType  Type = NodeElement)

Creates a Node and makes it a child of this one, and puts at the beginning of the Child Nodes.

Parameters:
TypeThe NodeType of the Node to be added to the beginning list of child Nodes.
Returns:
A Node representing the freshly added Node, or an empty Node if there was an error.
Node Mezzanine::xml::Node::PrependChild ( const char_t Name)

Creates an element Node as a child of this Node, with the given name at the beginning of the children.

Parameters:
NameThe name of the Node to be created.

Calls Node::PrependChild(NodeType); using NodeElement as the NodeType.

Returns:
The desired Node on success, an empty Node on failure.
Node Mezzanine::xml::Node::PrependCopy ( const Node proto)

Copies a Node and puts the copy at the start of the list of this Nodes Childrem.

Parameters:
protoThe Node to be copied. If this is emptry, no work is performed.
Returns:
The copied Node on success, an empty Node on failure.
Attribute Mezzanine::xml::Node::PrependCopy ( const Attribute proto)

Copies an Attribute and puts the copy at the beginning of this Nodes attributes.

Parameters:
protoThe attribute to be copied.

This attempts to create a copy of an attribute Attribute and stick it at the beginning of the list of attribute on the current Node. This will fail and return an Empty Attribute if this Node is neither an Element nor a Declaration. This will fail and return an empty attribute if this Node is empty.

Returns:
The created Attribute or an empty Attribute on Failure.
void Mezzanine::xml::Node::Print ( Writer WriterInstance,
const char_t indent = XML_TEXT("\t"),
unsigned int  flags = FormatDefault,
Encoding  DocumentEncoding = EncodingAuto,
unsigned int  Depth = 0 
) const

Output the XML document using a Writer.

Parameters:
WriterInstanceThe Writer that will be used to output the xml text.
indentThe Character(s) used to represent a tab in the output, this defaults to one tab character.
flagsThe output format flags, this is a bitfield that defaults to xml::FormatDefault.
DocumentEncodingThe xml::Encoding of the document, whichs defaults to EncodingAuto
DepthThis defaults to 0. The amount of times to prepend the indentation to the beginning of each output line.

This will never write a Byte Order Mark(BOM), and will default to not outputing a document declaration.

void Mezzanine::xml::Node::Print ( std::basic_ostream< wchar_t, std::char_traits< wchar_t > > &  os,
const char_t indent = XML_TEXT("\t"),
unsigned int  flags = FormatDefault,
unsigned int  Depth = 0 
) const

Output the XML document using a Output Stream.

Parameters:
osAn output stream to send xml text to.
indentThe Character(s) used to represent a tab in the outpput, this defaults to one tab character.
flagsThe output format flags, this is a bitfield that defaults to xml::FormatDefault
DepthThis defaults to 0. The amount of times to prepend the indentation to the beginning of each output line.

This will never write a Byte Order Mark(BOM), and will default to not outputing a document declaration.

void Mezzanine::xml::Node::Print ( std::basic_ostream< char, std::char_traits< char > > &  os,
const char_t indent = XML_TEXT("\t"),
unsigned int  flags = FormatDefault,
Encoding  DocumentEncoding = EncodingAuto,
unsigned int  Depth = 0 
) const

Output the XML document using a Output Stream.

Parameters:
osAn output stream to send xml text to.
indentThe Character(s) used to represent a tab in the outpput, this defaults to one tab character.
flagsThe output format flags, this is a bitfield that defaults to xml::FormatDefault
DocumentEncodingThe xml::Encoding of the document, whichs defaults to EncodingAuto
DepthThis defaults to 0. The amount of times to prepend the indentation to the beginning of each output line.

This will never write a Byte Order Mark(BOM), and will default to not outputing a document declaration.

Mezzanine::xml::Node::RemoveAttribute ( const Attribute a)

Remove specified Attribute.

Parameters:
aThe Attribute to look for. If the given Attribute doesn't belong to this Node then this will fail
Returns:
True if the removal was successful, false otherwise
Mezzanine::xml::Node::RemoveAttribute ( const char_t Name)

Remove Attribute as specified by name.

Parameters:
NameThe name of the Attribute to remove.
Returns:
True if the removal was successful, false otherwise.
Mezzanine::xml::Node::RemoveChild ( const Node n)

Remove specified child element.

Parameters:
nThe Node to look for. If the given Attribute doesn't belong to this Node then this will fail
Returns:
True if the removal was successful, false otherwise
bool Mezzanine::xml::Node::RemoveChild ( const char_t Name)

Remove child element as specified by name.

Parameters:
NameThe name of the Node to remove.
Returns:
True if the removal was successful, false otherwise
bool Mezzanine::xml::Node::SetName ( const char_t rhs)

Set the name of .

Parameters:
rhsThe desired name.
Returns:
True if successful, returns false if the name cannot be stored or there is not enough memory.
bool Mezzanine::xml::Node::SetName ( const String rhs) [inline]

Set the name of this object.

Parameters:
rhsThe desired name .
Returns:
True if successful, returns false if the name cannot be stored or there is not enough memory.

Definition at line 579 of file xml.h.

bool Mezzanine::xml::Node::SetValue ( const char_t rhs)

Set the value of this.

Parameters:
rhsThe new Value.
Returns:
True if successful, returns false if this is empty or there is not enough memory.
Todo:

update this to make the error return code redundant and use an exception instead.

Review for possiblity of buffer overflow.

Mezzanine::xml::Node::Traverse ( TreeWalker walker)

Perform sophisticated (or whatever) algorithms on this and all descendant Nodes in the XML tree.

Parameters:
walkerAny class that fully implement xml::Treewalker. This is where the algorithm to be run is located.
Returns:
True if every descendant Node of this Node was iterated through, false if it didn't go through every Node.
See also:
xml::TreeWalker
Mezzanine::xml::Node::Type ( ) const

Identify what kind of Node this is.

Returns:
A NodeType identifying this Node, or o/NULL if this Node is empty.
Mezzanine::xml::Node::Value ( ) const

Get the Value of this Node.

Returns:
Returns A pointer to a const c-style array of the the character type (usually char or wchar_t) containing the value.
Warning:
returns "" if Node is empty.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines