%XML.Node
class %XML.Node extends %Library.RegisteredObject
For details on using this class, see Representing an XML Document as a DOM.
%XML.Node may be used to navigate the an XML document which is represented as an Document Object Model (DOM) using the %XML.Document. The %XML.Document may be created eitherThe %XML.Node instance that is used to navigate the DOM is created using the GetDocumentElement() of %XML.Document.
%XML.Node navigates through the nodes of the DOM rather than representing a fixed node in a DOM tree. The MoveToxxx methods are used to move through the DOM. The properties and methods of %XML.Node are then used to retrieve and modify the node contents.
Property Inventory
Method Inventory
- AppendCharacter()
- AppendElement()
- AppendNode()
- AppendTree()
- AttributeDefined()
- FirstAttributeName()
- GetAttribute()
- GetAttributeNS()
- GetAttributeNamespace()
- GetAttributeQName()
- GetAttributeQNameNS()
- GetAttributeValue()
- GetAttributeValueNS()
- GetAttributeValueNamespace()
- GetAttributeValueNamespaceNS()
- GetNumberAttributes()
- GetText()
- HasChildNodes()
- InsertCharacter()
- InsertElement()
- InsertNode()
- InsertTree()
- IsDescendant()
- LastAttributeName()
- MoveToFirstChild()
- MoveToLastChild()
- MoveToNextSibling()
- MoveToParent()
- MoveToParentElement()
- MoveToPreviousSibling()
- NextAttributeName()
- PreviousAttributeName()
- Remove()
- RemoveAttribute()
- RemoveAttributeNS()
- ReplaceCharacter()
- ReplaceElement()
- ReplaceNode()
- ReplaceTree()
- Serialize()
- SetAttribute()
Properties
property Document as %XML.Document;
The DOM that this %XML.Node instance is navigating. The Document property may be
set to change which DOM is being navigated. When the Document is set, %XML.Node is
positioned at the document node, i.e. the parent of the root element.
Property methods: DocumentGet(), DocumentGetSwizzled(), DocumentIsValid(), DocumentNewObject()
property LocalName as %String [ Calculated ];
Local name for element node.
Property methods: LocalNameDisplayToLogical(), LocalNameIsValid(), LocalNameLogicalToDisplay(), LocalNameLogicalToOdbc(), LocalNameNormalize()
property Namespace as %String [ Calculated ];
XML namespace for element node.
Property methods: NamespaceDisplayToLogical(), NamespaceIsValid(), NamespaceLogicalToDisplay(), NamespaceLogicalToOdbc(), NamespaceNormalize()
property NamespaceIndex as %String [ Calculated ];
Index into XML namespace table for element node.
Property methods: NamespaceIndexDisplayToLogical(), NamespaceIndexIsValid(), NamespaceIndexLogicalToDisplay(), NamespaceIndexLogicalToOdbc(), NamespaceIndexNormalize()
property Nil as %Boolean [ Calculated ];
True if xsi:nil or xsi:null specified as true or 1 for this element node.
Property methods: NilDisplayToLogical(), NilIsValid(), NilLogicalToDisplay(), NilNormalize()
property NodeData as %String [ Calculated ];
Value of a character node.
Property methods: NodeDataDisplayToLogical(), NodeDataIsValid(), NodeDataLogicalToDisplay(), NodeDataLogicalToOdbc(), NodeDataNormalize()
property NodeId as %String;
The id of the current node.
The NodeId property may be set in order to move the specified node.
Property methods: NodeIdDisplayToLogical(), NodeIdGet(), NodeIdIsValid(), NodeIdLogicalToDisplay(), NodeIdLogicalToOdbc(), NodeIdNormalize()
property NodeType as %String [ Calculated ];
Type of node: $$$xmlELEMENTNODE, $$$xmlTEXTNODE, $$$xmlWHITESPACENODE.
Property methods: NodeTypeDisplayToLogical(), NodeTypeIsValid(), NodeTypeLogicalToDisplay(), NodeTypeLogicalToOdbc(), NodeTypeNormalize()
property QName as %String [ Calculated ];
Qname for element node.
Only used for output as XML when the prefix is valid for the document.
Property methods: QNameDisplayToLogical(), QNameIsValid(), QNameLogicalToDisplay(), QNameLogicalToOdbc(), QNameNormalize()
Methods
Append new character data node to the list of children of this element node.
The current node pointer does not change. This node is still the parent of the appended child.
If raw is true, the node is marked as $$$xmlRAWTEXTNODE
parent is for internal use only.
If raw is true, the node is marked as $$$xmlRAWTEXTNODE
parent is for internal use only.
method AppendElement(localName As %String, namespace As %String = "", text As %String, qname As %String = "")
Append new element node to the list of children of this node.
If the text argument is specified, then character data is added as
the child of the new element.
The current node pointer does not change. This node is still the parent of the appended child.
Append a copy of the specified node to the list of children of this node.
The node to copy may be from any document.
The current node pointer does not change. This node is still the parent of the appended child.
Append a copy of the specified node, including all its children, to the list of children of this node.
The tree to copy may be from any document, but this node may not be a descendant of the source node.
The current node pointer does not change. This node is still the parent of the appended child.
Return non-zero (true) if attribute named attributeName exists for this element.
method FirstAttributeName() as %String
Return attribute name for first attribute for this element.
method GetAttribute(attributeName As %String, ByRef namespace As %String, ByRef value As %String, ByRef valueNamespace As %String)
Return attribute data of attribute named attributeName for this element.
namespace is the namespace URI from QName of attribute named attributeName for this element.
value is the attribute value.
valueNamespace is the namespace URI corresponding to the prefix when the attribute value is of the form "prefix:value".
method GetAttributeNS(attributeName As %String, namespace As %String, ByRef value As %String, ByRef valueNamespace As %String)
Return attribute data of attribute named attributeName in namespace for this element.
value is the attribute value.
valueNamespace is the namespace URI corresponding to the prefix when the attribute value is of the form "prefix:value".
Return namespace URI from QName of attribute named attributeName for this element.
Return QName of attribute named attributeName for this element.
Return QName of attribute named attributeName in namespace for this element.
Return value of attribute named attributeName for this element.
Return value of attribute named attributeName in namespace for this element.
Return namespace of value of attribute named attributeName for this element.
Return namespace value of attribute named attributeName in namespace for this element.
method GetNumberAttributes() as %Integer
Return number of attributes for this element.
Get the text contents of an element node.
GetText returns false if an error is encountered in evaluating the node.
GetText returns true if text is found. The text which is found may be the empty string.
The found text is appended to the text argument.
The text argument is created if it is not already defined.
If the mixed argument is = 1, then the mixed character and element content in the
current node is returned in the text argument.
Return non-zero (true) if this node has any child nodes.
Insert a new character data node to the list of children of this element node.
The new character data is inserted just before the specified child node.
The child node is specified by passing its NodeId.
The child node is passed by reference so that it may be updated with a new NodeId after the insert.
The nodeId of the inserted character data node is returned.
The current node pointer does not change. This node is still the parent of the appended child.
method InsertElement(localName As %String, namespace As %String = "", ByRef child As %String, text As %String, qname As %String = "") as %String
Insert a new element node to the list of children of this node.
The new element is inserted just before the specified child node.
The child node is specified by passing its NodeId.
The child node is passed by reference so that it may be updated with a new NodeId after the insert.
The nodeId of the inserted element is returned.
If the text argument is specified, then character data is added as
the child of the new element.
The current node pointer does not change. This node is still the parent of the appended child.
Insert a copy of the specified node to the list of children of this node.
The node to copy may be from any document.
The new node is inserted just before the specified child node.
The child node is specified by passing its NodeId.
The child node is passed by reference so that it may be updated with a new NodeId after the insert.
The nodeId of the inserted node is returned.
The current node pointer does not change.
Insert a copy of the specified node, including its children, to the list of children of this node.
The tree to copy may be from any document, but this node may not be a descendant of the source node.
The new node is inserted just before the specified child node.
The child node is specified by passing its NodeId.
The child node is passed by reference so that it may be updated with a new NodeId after the insert.
The nodeId of the inserted node is returned.
The current node pointer does not change.
Check is a this node is the descendant of specified node
method LastAttributeName() as %String
Return attribute name for last attribute for this element.
Move node to current node's first child node.
Optionally skip whitespace nodes.
Move node to current node's last child node.
Optionally skip whitespace nodes.
Move node to current node's next sibling.
Optionally skip whitespace nodes.
Move node to current node's parent.
If restrictDocumentNode is true, then MoveTopParent will not move to document node.
If restrictDocumentNode is true, then MoveTopParent will not move to document node.
Move node to current node's ancestor which has the specified local name.
Move node to current node's previous sibling.
Optionally skip whitespace nodes.
Return attribute name for next attribute for this element.
Return attribute name for previous attribute for this element.
method Remove()
Remove the current node and make its parent the current node.
method RemoveAttribute(attributeName As %String)
Remove attribute named attributeName for this element.
Remove attribute named attributeName in namespace for this element.
method ReplaceCharacter(text As %String)
Replace this node with a character node.
method ReplaceElement(localName As %String, namespace As %String = "", text As %String, qname As %String = "")
Replace this node with an element node.
Replace this node with a copy of the specified node.
The node to copy may be from any document.
The current node pointer does not change.
Replace this node with a copy of the specified node including all its children.
The tree to copy may be from any document, but this node may not be a descendant of the source node.
The current node pointer does not change.
method Serialize(Output endElementText) as %String
Serialize this node as element
method SetAttribute(attributeName As %String, namespace As %String = "", value As %String = "", valueNamespace As %String = "")
Set attribute data of attribute named attributeName for this element.
namespace is the namespace URI from QName of attribute named attributeName for this element.
value is the attribute value.
valueNamespace is the namespace URI corresponding to the prefix when the attribute value is of the form "prefix:value".
Inherited Members
Inherited Methods
- %AddToSaveSet()
- %ClassIsLatestVersion()
- %ClassName()
- %ConstructClone()
- %DispatchClassMethod()
- %DispatchGetModified()
- %DispatchGetProperty()
- %DispatchMethod()
- %DispatchSetModified()
- %DispatchSetMultidimProperty()
- %DispatchSetProperty()
- %Extends()
- %GetParameter()
- %IsA()
- %IsModified()
- %New()
- %NormalizeObject()
- %ObjectModified()
- %OriginalNamespace()
- %PackageName()
- %RemoveFromSaveSet()
- %SerializeObject()
- %SetModified()
- %ValidateObject()