IGLib 1.4
The IGLib base library for development of numerical, technical and business applications.

IG::Lib::XmlBuilder Class Reference

Class that enables custom parsing and building of an Xml document. More...

Inheritance diagram for IG::Lib::XmlBuilder:
Collaboration diagram for IG::Lib::XmlBuilder:

List of all members.

Public Member Functions

void NewDocument ()
 Creates a new Xml document.
void NewDocument (string RootName)
 Creates a new Xml document with a specified name of hte root element.
XmlNode Discard ()
 Discards the newly created node and returns it if it exists.
XmlNode SetAttribute (string name, string value)
 Sets a named attribute of the currently treated node to a specific value. This only works if the currently treated node is an XML element. If an attribute with a specified name dose not yet exist then it is created, otherwise old value is overwritten.
XmlNode RemoveAttribute (string name)
 Removes the attribute with a specified name from the currently treated XML node, and returns this node or null if the operation was not successful (e.g. if the treated node is not defined or if the attribute with a specified name does not exist). This function does not report any errors.
XmlNode SetValue (string value)
 Sets value of the currently treated XML node. If the currently treated node is a text node then value is set directly. If the currently treated node is an element then value is set on its first chilld text node if such a node exists. If the element has no children, a text child node is created.
XmlNode SetInnerText (string value)
 Sets inner text of the currently treated XML node.
XmlNode RemoveNode (XmlNode node)
 Removes the specified node from the current XML document and returns that node. null is returned if the node can not be removed. CAUTION: Removing the node may destroy information about previous node and thus render the Back() operation impossible. It may also affect marks, which is not checked by any function but the BackMark() following removal may fail.
XmlNode RemoveCurrent ()
 Removes the current node and returns the removed node or null if the operation does not succeed. The current node is moved to the next node and may become null if the current node was the last one in the given child list.

Protected Attributes

XmlNode _new = null

Properties

XmlNode Treated [get]
 Returns the Xml node that is currently treaded. All modifications apply to this node. If a newly created node exists that has not been inserted into the document yet then this node is returned. Otherwise, the current node is returned.
XmlElement TreatedElement [get]
 Returns Treated if this node is Xml element, or null if it is not or if treated is null.
XmlNode NewNode [get, set]
 Gets or sets the newly created node (if one exists). When the newly created node is inserted into the document, it is not accessible any more through NewNode or Treated properties. If set to a node from another document, a deep copy is created and imported. If set to a node from the current document that is already included in the document, a deep copy is created and set. If set to a node from the current document that is not included in the document, a reference to the node is set.
XmlElement NewElement [get]
 Returns NewNode if it is an Xml Element, or null if it is not.

Private Member Functions

XmlDocument NewXmlDocument ()
XmlDocument NewXmlDocument (string RootName)
XmlNode CreateNode (XmlNodeType type, string name, string value, string namespaceURI)
 Creates a new node and sets this node as treated node. If there already exist a newly created node then it must be unassigned first (e.g. by Discard()), otherwise this method fails. The new node also gets unassigned when it is inserted into the document.
XmlNode InsertBefore ()
 Inserts the newly created node before the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).
XmlNode InsertAfter ()
 Inserts the newly created node after the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).
XmlNode AppendChild ()
 Appends the newly created node after the last child of the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).
XmlNode PrependChild ()
 Inserts the newly created node before the first child of the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).

Detailed Description

Class that enables custom parsing and building of an Xml document.


Member Function Documentation

XmlDocument IG::Lib::XmlBuilder::NewXmlDocument ( ) [inline, private]
XmlDocument IG::Lib::XmlBuilder::NewXmlDocument ( string  RootName) [inline, private]
void IG::Lib::XmlBuilder::NewDocument ( ) [inline]

Creates a new Xml document.

void IG::Lib::XmlBuilder::NewDocument ( string  RootName) [inline]

Creates a new Xml document with a specified name of hte root element.

Parameters:
RootNameName of the root element.
XmlNode IG::Lib::XmlBuilder::Discard ( ) [inline]

Discards the newly created node and returns it if it exists.

Returns:
The discarded Xml node or null if there was no newly created node.
XmlNode IG::Lib::XmlBuilder::SetAttribute ( string  name,
string  value 
) [inline]

Sets a named attribute of the currently treated node to a specific value. This only works if the currently treated node is an XML element. If an attribute with a specified name dose not yet exist then it is created, otherwise old value is overwritten.

Parameters:
nameName of the attribute to be set.
valueValue of the attribute.
Returns:
The node for which the attribute has been set, or null if the attribute could not be set.
XmlNode IG::Lib::XmlBuilder::RemoveAttribute ( string  name) [inline]

Removes the attribute with a specified name from the currently treated XML node, and returns this node or null if the operation was not successful (e.g. if the treated node is not defined or if the attribute with a specified name does not exist). This function does not report any errors.

Parameters:
nameName of the attribute to be removed.
Returns:
The node on which atttribute is removed (which is the currently treated node), or null if the operation could not be performed (this function does not report any errors).
XmlNode IG::Lib::XmlBuilder::SetValue ( string  value) [inline]

Sets value of the currently treated XML node. If the currently treated node is a text node then value is set directly. If the currently treated node is an element then value is set on its first chilld text node if such a node exists. If the element has no children, a text child node is created.

XmlNode IG::Lib::XmlBuilder::SetInnerText ( string  value) [inline]

Sets inner text of the currently treated XML node.

XmlNode IG::Lib::XmlBuilder::RemoveNode ( XmlNode  node) [inline]

Removes the specified node from the current XML document and returns that node. null is returned if the node can not be removed. CAUTION: Removing the node may destroy information about previous node and thus render the Back() operation impossible. It may also affect marks, which is not checked by any function but the BackMark() following removal may fail.

Parameters:
nodeXML node to be removed.
XmlNode IG::Lib::XmlBuilder::RemoveCurrent ( ) [inline]

Removes the current node and returns the removed node or null if the operation does not succeed. The current node is moved to the next node and may become null if the current node was the last one in the given child list.

XmlNode IG::Lib::XmlBuilder::CreateNode ( XmlNodeType  type,
string  name,
string  value,
string  namespaceURI 
) [inline, private]

Creates a new node and sets this node as treated node. If there already exist a newly created node then it must be unassigned first (e.g. by Discard()), otherwise this method fails. The new node also gets unassigned when it is inserted into the document.

Parameters:
type
name
value
namespaceURI
Returns:
XmlNode IG::Lib::XmlBuilder::InsertBefore ( ) [inline, private]

Inserts the newly created node before the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).

Returns:
The newly created node if operation is successful, null otherwise.
XmlNode IG::Lib::XmlBuilder::InsertAfter ( ) [inline, private]

Inserts the newly created node after the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).

Returns:
The newly created node if operation is successful, null otherwise.
XmlNode IG::Lib::XmlBuilder::AppendChild ( ) [inline, private]

Appends the newly created node after the last child of the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).

Returns:
The newly created node if operation is successful, null otherwise.
XmlNode IG::Lib::XmlBuilder::PrependChild ( ) [inline, private]

Inserts the newly created node before the first child of the current node. The new node is set to null if the operation is successful (otherwise it remains unchanged).

Returns:
The newly created node if operation is successful, null otherwise.

Member Data Documentation

XmlNode IG::Lib::XmlBuilder::_new = null [protected]

Property Documentation

XmlNode IG::Lib::XmlBuilder::Treated [get]

Returns the Xml node that is currently treaded. All modifications apply to this node. If a newly created node exists that has not been inserted into the document yet then this node is returned. Otherwise, the current node is returned.

XmlElement IG::Lib::XmlBuilder::TreatedElement [get]

Returns Treated if this node is Xml element, or null if it is not or if treated is null.

XmlNode IG::Lib::XmlBuilder::NewNode [get, set]

Gets or sets the newly created node (if one exists). When the newly created node is inserted into the document, it is not accessible any more through NewNode or Treated properties. If set to a node from another document, a deep copy is created and imported. If set to a node from the current document that is already included in the document, a deep copy is created and set. If set to a node from the current document that is not included in the document, a reference to the node is set.

XmlElement IG::Lib::XmlBuilder::NewElement [get]

Returns NewNode if it is an Xml Element, or null if it is not.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties Events