%XML.Document
Class %XML.Document Extends (%XML.ImportHandler, %XML.Node) [ Inheritance = right, System = 2 ]
For details on using this class, see Representing an XML Document as a DOM.
%XML.Document represents an XML document as an Document Object Model (DOM). The DOM may be created either
- from an XML document by accessing the Document property of %XML.Reader after calling an Openxxx method of %XML.Reader.
- as a new DOM by calling the CreateDocument of this class.
The %XML.Document class maintains the namespaces for the DOM. The %XML.Node class created by GetDocumentElement may be used to navigate the DOM or the macros in %xmlDOM.inc may be used to navigate the DOM based on the DocumentId of %XML.Document.
Methods
CreateDocument
ClassMethod CreateDocument(localName As %String, namespace As %String) As %XML.Document
Create a new Document Object Model (DOM) consisting of only a root element.
GetDocumentFromStream
ClassMethod GetDocumentFromStream(stream As %BinaryStream, Output document As %XML.Document) As %Status
Create a doocument by parsing the XML document contained in a stream.
The parsed document is returned in document.
A %Status is returned to indicate if parsing is successful.
GetDocumentElement
Method GetDocumentElement() As %XML.Node [ CodeMode = expression ]
Returns an %XML.Node DOM navigation object which is positioned at the the root element of this Document.
GetDocumentNode
Method GetDocumentNode() As %String [ CodeMode = expression ]
Returns the node id of the root element of this Document.
GetNode
Method GetNode(nodeId As %String) As %XML.Node
Returns an %XML.Node DOM navigation object which is positioned at the the node specified by the nodeId argument.
GetNodeById
Method GetNodeById(id As %String) [ CodeMode = expression ]
Return nodeId for node with id attribute = %id.
SetNodeById
Method SetNodeById(id As %String, nodeId As %Integer)
Save nodeId for node with id attribute = %id.
GetNamespace
Method GetNamespace(nsIndex As %Integer) As %String [ CodeMode = expression ]
Return XML namespace URI for nsIndex into document's namespace table.
CountNamespace
Method CountNamespace() As %Integer [ CodeMode = expression ]
Return number of namepsaces in document's namespace table.
InsertNamespace
Method InsertNamespace(namespace As %String)
Return XML namespace URI for nsIndex into document's namespace table.
FindNamespace
Method FindNamespace(namespace As %String) As %Integer [ CodeMode = expression ]
Return XML nsIndex into document's namespace table for namespace URI.
GetVersion
Method GetVersion() As %Integer [ CodeMode = expression ]
Return the version of the import handler that constructed this document. A programmatically constructed DOM will always have version "".