JadeXMLElement Class

The JadeXMLElement class represents an XML element in a document tree. An element can have attributes, child nodes, and textual content.

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

Property Contains the …
attributes Array of attributes of the element
localName Local name (without the prefix) of the element
namespaceURI Namespace URI of the element
tagName Qualified name (with the prefix) of the element
textData Text data of a text-only element

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

Method Description
addAttribute Creates and adds an attribute
addAttributeNS Creates and adds an attribute with a namespace
addAttributeObject Adds an attribute object
addAttributeObjectNS Adds an attribute object with a namespace
addCDATA Creates and adds a CDATA node
addCDATAObject Adds a CDATA object
addComment Creates and adds a comment
addCommentObject Adds a comment object
addElement Creates and adds an element
addElementNS Creates and adds an element with a namespace
addElementObject Adds an element object
addElementObjectNS Adds an element object with a namespace
addProcessingInstruction Creates and adds a processing instruction
addProcessingInstructionObject Adds a processing instruction object
addText Creates and adds a text node
addTextObject Adds a text object
findAllElementsByNameNS Fills an array with all descendant elements with the specified namespace URI and local name
findAllElementsByTagName Fills an array with all descendant elements with the specified tag name
getAllElementsByTagName Fills an array with all descendant elements with the specified tag name
getAllElementsByTagNameNS Fills an array with all descendant elements with the specified namespace URI and local name
getAttributeByName Returns the attribute with the specified name
getAttributeByNameNS Returns the attribute with the specified namespace URI and local name
getElementByTagName Returns the first immediate child element with the specified tag name
getElementByTagNameNS Returns the first immediate child element with the specified namespace URI and local name
getElementsByTagName Fills an array with the immediate child elements with the specified tag name
getElementsByTagNameNS Fills an array with the immediate child elements with the specified namespace URI and local name
namespacePrefix Returns the namespace prefix
parentElement Returns the parent element of the element
setText Sets the text content of the element
text Returns the text content of the element

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

As the getAllElementsByTagNameNS and getAllElementsByTagName methods scan sequentially to locate all requested elements, they always returned requested elements in document sequence. To improve performance, you can use the findAllElementsByNameNS and findAllElementsByTagName 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.