Search these areas:
Help
Support Forums
Product Info



Introduction
DataWeb: What's New
Creating an Application
The DataWeb Designer
Application Management
Data Tables
Data Tables
Views
Templates
Components
Data Analysis
Members
Security
Importing
Exporting
FTP
JavaScript
Object Model
JavaScript Objects
General Scripting Objects
Data Access Objects
File Access Objects
Http Client Objects
Security and Membership Objects
Document Object Model (DOM)
-DOMAttribute Object
-DOMCDataSection
-DOMCharacterData
-DOMComment
-DOMDocument
-DOMDocumentType
-DOMElement
-DOMEntity
-DOMEntityReference
-DOMException
-DOMImplementation
-DOMNamedNodeMap
-DOMNode
insertBefore
replaceChild
removeChild
appendChild
hasChildNodes
cloneNode
normalize
isSupported
hasAttributes
-DOMNodeList
-DOMNotation
-DOMProcessingInstruction
-DOMText
Error Descriptions
Object Model Extensions
Full-Text Search
Domain and Email Hosting
HotBlock Modules
Account Management
Glossary
New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

DataWeb User's Guide

DOMNode
The DOMNode object represents a node in an XML document.

Instance Properties

nodeName A string denoting the name of the node. Read only.
nodeValue A string denoting the value of the node, if applicable.  Attribute nodes will return values for both nodeName and nodeValue, since an attribute node consists of a name/value pair. This property is NULL except for the following nodes:
DOMAttribute,
DOMCharacterData,
DOMComment,
DOMProcessingInstruction,
DOMText
nodeType A number denoting the type of node. Read only.
1  ELEMENT_NODE
2  ATTRIBUTE_NODE
3  TEXT_NODE
4  CDATA_SECTION_NODE
5  ENTITY_REFERENCE_NODE
6  ENTITY_NODE
7  PROCESSING_INSTRUCTION_NODE
8  COMMENT_NODE
9  DOCUMENT_NODE
10 DOCUMENT_TYPE_NODE
11 DOCUMENT_FRAGMENT_NODE
12 NOTATION_NODE
parentNode The DOMNode object representing the parent of this node, or null if there is no parent. These node objects are parentless: DOMDocument , DOMDocumentFragment , DOMAttribute, DOMEntity, DOMDocumentType, and DOMNotation.
firstChild The DOMNode object representing the first child of this node, or null if there are no children.
lastChild The DOMNode object representing the last child of this node, or null if there are no children.
previousSibling The DOMNode object representing the node immediately preceding this node, or null if no nodes precede this node.
nextSibling The DOMNode object representing the node immediately following this node, or null if this is the last node.
attributes A DOMNamedNodeMap containing the attributes of this node. This property is applicable only to nodes that are elements.
ownerDocument The DOMDocument object associated with this node. For DOMDocument objects, this property is null.
namespaceURI The namespace URI of this node, or null if it is unspecified.

Instance Methods

insertBefore Inserts a DOMNode object before a specified node.
replaceChild Replaces a specified child DOMNode object with another specified DOMNode object.
removeChild Removes a node from the list of children.
appendChild Adds a specified DOMNode object to the end of the list of children of the calling node.
hasChildNodes Indicates whether a node has any children.
cloneNode Returns a duplicate of the calling DOMNode object.
normalize Puts all Text nodes at the full depth of the sub-tree underneath this node, including attribute nodes, into a "normal" form where only structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
isSupported Tests whether the DOM implementation implements a specific feature and whether that feature is supported by the calling node.
hasAttributes Returns whether the calling node (if it is an element) has any attributes.


Examples

The following example demostrates the instance properties of the DOMNode object. It also shows how DOMDoc objects inherit the properties and methods of the DOMNode objet.

var str = '<table border="1" cellspacing="o" cellpadding="0"    
colspan="2"><tr><td>cell1</td><td>cell2</td></tr>
<tr><td>cell3</td><td>cell4</td></tr></table>';

    //doc is a DOMDoc object representing a table with four cells
var doc = new DOMDocument(str);

response.write("doc.documentElement: ",   
   doc.documentElement, "<br>");
response.write("doc.documentElement.nodeName: ", 
   doc.documentElement.nodeName, "<br>");
response.write("doc.documentElement.childNodes
.item(0).nodeName: ", 
   doc.documentElement.childNodes
.item(0).nodeName, "<br>");

//rewrites the text in the first cell
doc.documentElement.firstChild.firstChild.firstChild.nodeValue = "hello";

response.write("doc.documentElement: ", doc.documentElement); 

Output:

doc.documentElement:
cell1cell2
cell3cell4

doc.documentElement.nodeName: table
doc.documentElement.childNodes.item(0).nodeName: tr

doc.documentElement:
hellocell2
cell3cell4

Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
Email Us