The XMLDOMElement Object

The XMLDOMElement Object

The XMLDOMElement object represents elements and is probably the most common node object you'll deal with. Because attributes are not considered child nodes of an element object, you use special methods to get the attributes of an element. For example, you can use the getAttribute method, which returns an XMLDOMNamedNodeMap object that contains all the element's attributes.

Here are the base properties of the XMLDOMElement object:

  • attributes The list of attributes for this node. Read-only.

  • baseName * The base name for the name qualified with the namespace. Read-only.

  • childNodes A node list containing the children. Read-only.

  • dataType * The data type for this node. Read/write.

  • definition * The definition of the node in the DTD or schema.

  • firstChild The first child of this node. Read-only.

  • lastChild The last child node of this node. Read-only.

  • namespaceURI * The URI for the namespace. Read-only.

  • nextSibling The next sibling of this node. Read-only.

  • nodeName The qualified name of an element, attribute, or entity reference, or a string for other node types. Read-only.

  • nodeType The XML DOM node type. Read-only.

  • nodeTypeString * The node type in string form. Read-only.

  • nodeValue The text associated with the node. Read/write.

  • ownerDocument The root of the document. Read-only.

  • parentNode The parent node of the current node. Read-only.

  • parsed * True if this node and all descendants have been parsed; false otherwise . Read-only.

  • prefix * The namespace prefix. Read-only.

  • previousSibling The previous sibling of this node. Read-only.

  • specified * Indication of whether the node is explicitly specified or derived from a default value in the DTD or schema. Read-only.

  • tagName The element name. Read-only.

  • text * The text content of the node and its subtrees. Read/write.

  • xml * The XML representation of the node and all its descendants. Read-only.

Here are the base methods of the XMLDOMElement object:

  • appendChild Appends a new child as the last child of the current node

  • cloneNode Returns a new node that is a copy of this node

  • getAttribute Gets the value of the named attribute

  • getAttributeNode Gets the named attribute node

  • getElementsByTagName Returns a list of all descendant elements that match the given name

  • hasChildNodes Is true if this node has children

  • insertBefore Inserts a child node before the given node

  • normalize Normalizes all descendent elements, combining two or more text nodes next to each other into one text node

  • removeAttribute Removes or replaces the named attribute

  • removeAttributeNode Removes the given attribute from this element

  • removeChild Removes the given child node

  • replaceChild Replaces the given child node with the given new child node

  • selectNodes * Applies the given pattern-matching operation to this node's context, returning the list of matching nodes

  • selectSingleNode * Applies the given pattern-matching operation to this node's context, returning the first matching node

  • setAttribute Sets the value of a named attribute

  • setAttributeNode Adds or changes the given attribute node on this element

  • transformNode * Transforms this node and its children using the given XSL stylesheet

  • transformNodeToObject * Transforms this node and its children using the given XSL stylesheet, and returns the resulting transformation as an object

This object has no events.



Real World XML
Real World XML (2nd Edition)
ISBN: 0735712867
EAN: 2147483647
Year: 2005
Pages: 440
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net