JadeXMLDocument Class

The JadeXMLDocument class represents an XML document as a tree of nodes. It defines the owning object of all objects in the tree.

The properties defined in the JadeXMLDocument class are summarized in the following table.

Property Description
docType Document type of the document
endOfLine End-of-line separator for output
indentString Indentation string for output
keepWhitespace Specifies whether extra whitespace is discarded
outputDeclaration Specifies whether the XML declaration is output
rootElement Root element of the document

The methods defined in the JadeXMLDocument class are summarized in the following table.

Method Description
addComment Creates and adds a comment
addCommentObject Adds a comment object
addDocumentType Creates and adds a document type
addDocumentTypeObject Adds a document type object
addElement Creates and adds an element
addElementNS Creates and adds an element with a namespace URI
addElementObject Adds an element object
addElementObjectNS Adds an element object with a namespace URI
addProcessingInstruction Creates and adds a processing instruction
addProcessingInstructionObject Adds a processing instruction object
findElementByNameNS Returns an element with the specified namespace URI and local name
findElementByTagName Returns an element with the specified tag name
findElementsByNameNS Fills an array with all elements in the document with the specified namespace URI and local name
findElementsByTagName Fills an array with all elements in the document with the specified tag name
getElementByTagName Returns the first element with the specified tag name
getElementByTagNameNS Returns the first element with the specified namespace URI and local name
getElementsByTagName Fills an array with all elements in the document with the specified tag name
getElementsByTagNameNS Fills an array with all elements in the document with the specified namespace URI and local name
parseFile Parses an XML document file
parseString Parses an XML document string
writeToFile Writes the XML representation of the document to a file

For details, see "JadeXMLDocument Class", in Chapter 1 of the JADE Encyclopaedia of Classes.

As the getElementByTagName, getElementByTagNameNS, getElementsByTagName, and getElementsByTagNameNS methods scan sequentially to locate requested elements, they always returned requested elements in document sequence. To improve performance, you can use the findElementByNameNS, findElementByTagName, findElementsByNameNS, and findElementsByTagName methods to retrieve elements more directly through a collection, using the collection sequence. JADE fully supports the use of a mixture of the document and collection sequence methods to locate the requested elements.

The collection sequence methods provide a performance boost only if a localName or tagName parameter value is explicitly specified in the calling parameters. If you specify "*" in the localName or tagName parameter, the access method reverts to the functionality and performance of the document sequence methods to locate the requested elements.