Platforms to show: All Mac Windows Linux Cross-Platform
Back to XMLDocumentMBS class.
XMLDocumentMBS.adoptNode(node as XMLNodeMBS) as XMLNodeMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 23.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
If the node has a parent it is first removed from its parent child list. This effectively allows moving a subtree from one document to another.
Should not be needed in Xojo apps.
XMLDocumentMBS.ElementsByTagName(TagName as String) as XMLElementMBS()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
TagName: The tag name of the elements to match on. The special value "*" matches all local names.
Returns a new array object containing all the matched XMLElementMBS(s).
XMLDocumentMBS.ElementsByTagNameNS(namespaceURI as string, localName as String) as XMLElementMBS()
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
namespaceURI: The namespace URI of the elements to match on. The special value "*" matches all namespaces.
localName: The local name of the elements to match on. The special value "*" matches all local names.
Returns a new array object containing all the matched XMLElementMBS(s).
XMLDocumentMBS.evaluate(expression as String, contextNode as XMLNodeMBS, type as Integer) as XMLXPathResultMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 23.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
expression: The XPath expression string to be parsed and evaluated.
contextNode: The context is context node for the evaluation of this XPath expression. Must be owned by the same document and must be a XMLDocumentMBS, XMLElementMBS, XMLAttributeMBS, XMLTextMBS, XMLCDATASectionMBS, DOMComment, XMLProcessingInstructionMBS, or XPathNamespace node.
type: If a specific type is specified, then the result will be returned as the corresponding type. This must be one of the codes of the XMLXPathResultMBS clas constants.
Retruns result of the evaluation of the XPath expression as XMLXPathResultMBS class.
Raises exception if the expression is not legal according to the rules of the DOMXPathEvaluator.
Raises exception if the result cannot be converted to return the specified type.
XMLDocumentMBS.getElementById(elementId as String) as XMLElementMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
If no such element exists, returns nil.
Behavior is not defined if more than one element has this ID. The DOM implementation must have information that says which attributes are of type ID. Attributes with the name "ID" are not of type ID unless so defined. Implementations that do not know whether attributes are of type ID or not are expected to return nil.
elementId: The unique id value for an element.
Returns the matching element.
XMLDocumentMBS.importNode(node as XMLNodeMBS) as XMLNodeMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 23.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
You don't need to do this manually as the plugin will do it for you in methods as appendChild, replaceChild and insertBefore.
XMLDocumentMBS.IterateElementsByTagName(TagName as String) as XMLIterateElementsMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
For use with For Each Loops in Xojo.
XMLDocumentMBS.IterateElementsByTagNameNS(namespaceURI as string, localName as String) as XMLIterateElementsMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
For use with For Each Loops in Xojo.
XMLDocumentMBS.LoadXml(data as MemoryBlock)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
See also:
Some examples using this method:
XMLDocumentMBS.LoadXml(data as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
See also:
XMLDocumentMBS.LoadXml(file as FolderItem)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
This may reference other files in same folder.
See also:
XMLDocumentMBS.LoadXmlMT(data as MemoryBlock)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
See also:
XMLDocumentMBS.LoadXmlMT(data as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
See also:
XMLDocumentMBS.LoadXmlMT(file as FolderItem)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Replaces current document with the new one.
This may reference other files in same folder.
The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
See also:
XMLDocumentMBS.NodeFromHandle(Handle as Integer) as XMLNodeMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 23.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
Raises exception if this handle doesn't belong to this document.
XMLDocumentMBS.normalizeDocument
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 22.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This method acts as if the document was going through a save and load cycle, putting the document in a "normal" form. The actual result depends on the features being set. See XMLConfigurationMBS for details.
Noticeably this method normalizes XMLTextMBS nodes, makes the document "namespace wellformed", according to the algorithm described below in pseudo code, by adding missing namespace declaration attributes and adding or changing namespace prefixes, updates the replacement tree of XMLEntityReferenceMBS nodes, normalizes attribute values, etc. <br>Mutation events, when supported, are generated to reflect the changes occurring on the document. Note that this is a partial implementation. Not all the required features are implemented. Currently XMLAttributeMBS and XMLTextMBS nodes are normalized. Features to remove XMLCommentMBS and XMLCDATASectionMBS work.
XMLDocumentMBS.renameNode(node as XMLNodeMBS, namespaceURI as String, qualifiedName as String) as XMLNodeMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | XML | MBS XML Plugin | 23.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
When possible this simply changes the name of the given node, otherwise this creates a new node with the specified name and replaces the existing node with the new node as described below. This only applies to nodes of type ELEMENT_NODE and ATTRIBUTE_NODE.
When a new node is created, the following operations are performed: the new node is created, any registered event listener is registered on the new node, any user data attached to the old node is removed from that node, the old node is removed from its parent if it has one, the children are moved to the new node, if the renamed node is an XMLElementMBS its attributes are moved to the new node, the new node is inserted at the position the old node used to have in its parent's child nodes list if it has one, the user data that was attached to the old node is attach to the new node, the user data event NODE_RENAMED is fired.
When the node being renamed is an XMLAttributeMBS that is attached to an XMLElementMBS, the node is first removed from the XMLElementMBS attributes map. Then, once renamed, either by modifying the existing node or creating a new one as described above, it is put back.
node: The node to rename.
namespaceURI: The new namespaceURI.
qualifiedName: The new qualified name.
The items on this page are in the following plugins: MBS XML Plugin.