Platforms to show: All Mac Windows Linux Cross-Platform

Back to XMLNodeMBS class.

XMLNodeMBS.appendChild(newChild as XMLNodeMBS) as XMLNodeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds the node newChild to the end of the list of children of this node.

If the newChild is already in the tree, it is first removed.
newChild The node to add. If it is a XMLDocumentFragmentMBS object, the entire contents of the document fragment are moved into the child list of this node.

If the new node is from another document, we clone it first.

Returns the newly added node.

XMLNodeMBS.AttributeNode(Index as Integer) as XMLAttributeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries attribute node by index.

Index is zero based up to AttributeCount-1.

XMLNodeMBS.AttributeNodes as XMLAttributeMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries an array with all attributes.
Example

Dim doc As New XMLDocumentMBS
Dim node As XMLElementMBS = doc.createElement("Hello")

// add some attributes
node.AttributeValue("Hello") = "World"
node.AttributeValue("Value") = "123"
node.AttributeValue("Test") = "Value"

// now show them all in message dialogs
Dim attrs() As XMLAttributeMBS = node.AttributeNodes
For Each a As XMLAttributeMBS In attrs
MessageBox a.Name+": "+a.Value
Next

Gets a array containing the attributes of this node (if it is an XMLElementMBS) or null otherwise.

XMLNodeMBS.Child(Index as Integer) as XMLNodeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Queries child node with given index.
Example

Dim xml As String = "<test id=""123""><f>1</f><f>2</f><f>3</f><f>4</f></test>"
Dim doc As New XMLDocumentMBS(xml)
Dim node As XMLElementMBS = doc.DocumentElement

Dim count As Integer = node.ChildCount
Dim node0 As XMLNodeMBS = node.Child(0)
Dim node1 As XMLNodeMBS = node.Child(1)
Dim node2 As XMLNodeMBS = node.Child(2)
Dim node3 As XMLNodeMBS = node.Child(3)
'Dim node4 As XMLNodeMBS = node.Child(4) // out of bounds exception
Break // see debugger

Index is zero based up to ChildCount-1.

XMLNodeMBS.ChildNodes as XMLNodeMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Gets a DOMNodeList that contains all children of this node.
Example

Dim xml As String = "<test id=""123""><f>1</f><f>2</f><f>3</f><f>4</f></test>"
Dim doc As New XMLDocumentMBS(xml)
Dim DocumentElement As XMLElementMBS = doc.DocumentElement

Dim children() As XMLNodeMBS = DocumentElement.ChildNodes
For Each node As XMLNodeMBS In children
MessageBox node.toString
Next

If there are no children, this is a array containing no nodes.

The array is a static snapshot of the content of the node.

XMLNodeMBS.Clone(deep as Boolean) as XMLNodeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a duplicate of this node.

Pass true for deep parameter to copy all sub objects as well.

This function serves as a generic copy constructor for nodes.

The duplicate node has no parent ( parentNode returns nil.).

Cloning an XMLElementMBS copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child XMLTextMBS node. Cloning any other type of node simply returns a copy of this node.
deep If true, recursively clone the subtree under the specified node; if false, clone only the node itself (and its attributes, if it is an XMLElementMBS).

XMLNodeMBS.compareDocumentPosition(other as XMLNodeMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compares two nodes for their position in the document.

Compares the reference node, i.e. the node on which this method is being called, with a node, i.e. the one passed as a parameter, with regard to their position in the document and according to the document order.

other: The node to compare against this node.

Returns how the given node is positioned relatively to this node.

XMLNodeMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The private constructor.

XMLNodeMBS.insertBefore(newChild as XMLNodeMBS, refChild as XMLNodeMBS) as XMLNodeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Inserts the node newChild before the existing child node refChild.

If refChild is nil, insert newChild at the end of the list of children.

If newChild is a XMLDocumentFragmentMBS object, all of its children are inserted, in the same order, before refChild. If the newChild is already in the tree, it is first removed. Note that a XMLNodeMBS that has never been assigned to refer to an actual node is == nil.
newChild The node to insert.

refChild The reference node, i.e., the node before which the new node must be inserted.

If the new node is from another document, we clone it first.

Returns the new node.

XMLNodeMBS.isDefaultNamespace(namespaceURI as String) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
This method checks if the specified namespaceURI is the default namespace or not.

namespaceURI: The namespace URI to look for.
Returns true if the specified namespaceURI is the default namespace, false otherwise.

XMLNodeMBS.isEqualNode(other as XMLNodeMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Tests whether two nodes are equal.

This method tests for equality of nodes, not sameness (i.e., whether the two nodes are pointers to the same object) which can be tested with XMLNodeMBS::isSameNode. All nodes that are the same will also be equal, though the reverse may not be true.

Two nodes are equal if and only if the following conditions are satisfied: The two nodes are of the same type.The following string attributes are equal: nodeName, localName, namespaceURI, prefix, nodeValue , baseURI. This is: they are both null, or they have the same length and are character for character identical. The attributes node maps are equal. This is: they are both nil, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.The childNodes node lists are equal. This is: they are both nil, or they have the same length and contain equal nodes at the same index. This is true for XMLAttributeMBS nodes as for any other type of node. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared.

For two XMLDocumentTypeMBS nodes to be equal, the following conditions must also be satisfied: The following string attributes are equal: publicId, systemId, internalSubset. The entities node maps are equal. The notations node maps are equal.

On the other hand, the following do not affect equality: the ownerDocument attribute, the specified attribute for XMLAttributeMBS nodes, the isWhitespaceInElementContent attribute for XMLTextMBS nodes, as well as any user data or event listeners registered on the nodes.

other: The node to compare equality with.
If the nodes, and possibly subtrees are equal, true otherwise false.

XMLNodeMBS.isSameNode(other as XMLNodeMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns whether this node is the same node as the given one.

This method provides a way to determine whether two XMLNodeMBS references returned by the implementation reference the same object. When two XMLNodeMBS references are references to the same object, even if through a proxy, the references may be used completely interchangeably, such that all attributes have the same values and calling the same DOM method on either reference always has exactly the same effect.

other: The node to test against.

Returns true if the nodes are the same, false otherwise.

XMLNodeMBS.IterateAttributeNodes as XMLIterateAttributeNodesMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Iterates over the attributes.
Example

Dim doc As New XMLDocumentMBS("<doc id=""123"" value=""test""></doc>")

Dim root As XMLElementMBS = doc.DocumentElement
For Each e As XMLAttributeMBS In root.IterateAttributeNodes
MessageBox e.Name+": "+e.Value
Next

For use with For Each Loops in Xojo.

XMLNodeMBS.IterateChildNodes as XMLIterateChildNodesMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Iterates over the child nodes.
Example

Dim doc As New XMLDocumentMBS("<doc><test>abc</test><test>def</test></doc>")

Dim root As XMLElementMBS = doc.DocumentElement
For Each e As XMLElementMBS In root.IterateChildNodes
MessageBox e.toString
Next

For use with For Each Loops in Xojo.

XMLNodeMBS.lookupNamespaceURI(prefix as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Look up the namespace URI associated to the given prefix, starting from this node.

The prefix to look for. If this parameter is null, the method will return the default namespace URI if any.
Returns the associated namespace URI or null if none is found.

XMLNodeMBS.lookupPrefix(namespaceURI as String) as String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Look up the prefix associated to the given namespace URI, starting from this node.

The default namespace declarations are ignored by this method.

namespaceURI: The namespace URI to look for.

Returns an associated namespace prefix if found, null if none is found. If more than one prefix are associated to the namespace prefix, the returned namespace prefix is implementation dependent.

XMLNodeMBS.Normalize

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Normalizes the node tree.

Puts all XMLTextMBS nodes in the full depth of the sub-tree underneath this XMLNodeMBS, including attribute nodes, into a "normal" form where only markup (e.g., tags, comments, processing instructions, CDATA sections, and entity references) separates XMLTextMBS nodes, i.e., there are neither adjacent XMLTextMBS nodes nor empty XMLTextMBS nodes. This can be used to ensure that the DOM view of a document is the same as if it were saved and re-loaded, and is useful when operations (such as XPointer lookups) that depend on a particular document tree structure are to be used.

Note: In cases where the document contains CDATASections, the normalize operation alone may not be sufficient, since XPointers do not differentiate between XMLTextMBS nodes and XMLCDATASectionMBS nodes.

XMLNodeMBS.removeChild(Node as XMLNodeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Removes the child node indicated by oldChild from the list of children.

Returns the old node.

XMLNodeMBS.replaceChild(newChild as XMLNodeMBS, oldChild as XMLNodeMBS) as XMLNodeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.

If newChild is a XMLDocumentFragmentMBS object, oldChild is replaced by all of the XMLDocumentFragmentMBS children, which are inserted in the same order.

If the newChild is already in the tree, it is first removed.
newChild The new node to put in the child list.
oldChild The node being replaced in the list.

If the new node is from another document, we clone it first.

Returns the old node.

The items on this page are in the following plugins: MBS XML Plugin.


The biggest plugin in space...