The XMLDOMAttribute Object

The XMLDOMAttribute Object

In both the W3C DOM and the Microsoft DOM, attribute objects are node objects (that is, they are based on the node object), but they are not actually child nodes of an element and are not considered part of the document tree. Instead, attributes are considered properties of their associated elements (this means that properties such as parentNode , previousSibling , and nextSibling are meaningless for attributes). We'll see how to work with attributes in this chapter.

Here are the base properties of the XMLDOMAttribute 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 child nodes. Read-only.

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

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

  • firstChild The first child of the current node. Read-only.

  • lastChild The last child of the current node. Read-only.

  • name The attribute name. Read-only.

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

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

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

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

  • nodeTypedValue * The node's value. Read/write.

  • 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 (for nodes that can have parents). 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 (usually an attribute) is explicitly specified or derived from a default value. Read-only.

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

  • value The attribute's value. Read/write.

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

Here are the base methods of the XMLDOMAttribute object:

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

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

  • hasChildNodes True if this node has children

  • insertBefore Inserts a child node before the given node

  • removeChild Removes the given child node from the list

  • 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 a list of matching nodes

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

  • 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 result in an object

This object does not support any 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