w3schools    w3Schools
Search W3Schools :
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

XML Certification
Download XML editor
Custom Programming
Table of contents
XML DOM Tutorial
DOM Introduction
DOM Nodes
DOM Node Tree
DOM Parsing
DOM Load Function
DOM Methods
DOM Accessing
DOM Node Info
DOM Node List
DOM Traversing
DOM Browsers
DOM Navigating

Manipulate Nodes
DOM Get Values
DOM Change Nodes
DOM Remove Nodes
DOM Replace Nodes
DOM Create Nodes
DOM Add Nodes
DOM Clone Nodes
DOM HttpRequest

XML DOM Reference
DOM Node Types
DOM Node
DOM NodeList
DOM NamedNodeMap
DOM Document
DOM DocumentImpl
DOM DocumentType
DOM ProcessingInstr
DOM Element
DOM Attribute
DOM Text
DOM Comment
DOM HttpRequest
DOM ParseError Obj
DOM Parser Errors

DOM Summary

DOM Examples
DOM Validator

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Tutorials
W3Schools Forum

Helping W3Schools


XML DOM - The Node Object

prev next

The Node object represents a node in the document tree.

The Node Object

The Node object is the primary data type for the entire DOM.

The Node object represents a single node in the document tree.

A node can be an element node, an attribute node, a text node, or any other of the node types explained in the "Node types" chapter.

Notice that while all objects inherits the Node properties / methods for dealing with parents and children, not all objects can have parents or children. For example, Text nodes may not have children, and adding children to such nodes results in a DOM error.

IE: Internet Explorer, F: Firefox, O: Opera, W3C: World Wide Web Consortium (Internet Standard)

Node Object Properties

Property Description IE F O W3C
baseURI Returns the absolute base URI of a node No 1 No Yes
childNodes Returns a NodeList of child nodes for a node 5 1 9 Yes
firstChild Returns the first child of a node 5 1 9 Yes
lastChild Returns the last child of a node 5 1 9 Yes
localName Returns the local part of the name of a node No 1 9 Yes
namespaceURI Returns the namespace URI of a node No 1 9 Yes
nextSibling Returns the node immediately following a node 5 1 9 Yes
nodeName Returns the name of a node, depending on its type 5 1 9 Yes
nodeType Returns the type of a node 5 1 9 Yes
nodeValue Sets or returns the value of a node, depending on its type 5 1 9 Yes
ownerDocument Returns the root element (document object) for a node 5 1 9 Yes
parentNode Returns the parent node of a node 5 1 9 Yes
prefix Sets or returns the namespace prefix of a node No 1 9 Yes
previousSibling Returns the node immediately before a node 5 1 9 Yes
textContent Sets or returns the textual content of a node and its descendants No 1 No Yes
text Returns the text of a node and its descendants. IE-only property 5 No No No
xml Returns the XML of a node and its descendants. IE-only property 5 No No No

Node Object Methods

Method Description IE F O W3C
appendChild() Adds a new child node to the end of the list of children of a node 5 1 9 Yes
cloneNode() Clones a node 5 1 9 Yes
compareDocumentPosition() Compares the document position of two nodes No 1 No Yes
getFeature(feature,version) Returns a DOM object which implements the specialized APIs of the specified feature and version     No Yes
getUserData(key) Returns the object associated to a key on a this node. The object must first have been set to this node by calling setUserData with the same key     No Yes
hasAttributes() Returns true if a node has any attributes, otherwise it returns false No 1 9 Yes
hasChildNodes() Returns true if a node has any child nodes, otherwise it returns false 5 1 9 Yes
insertBefore() Inserts a new child node before an existing child node 5 1 9 Yes
isDefaultNamespace(URI) Returns whether the specified namespaceURI is the default     No Yes
isEqualNode() Checks if two nodes are equal No No No Yes
isSameNode() Checks if two nodes are the same node No 1 No Yes
isSupported(feature,version) Returns whether a specified feature is supported on a node     9 Yes
lookupNamespaceURI() Returns the namespace URI matching a specified prefix No 1 No Yes
lookupPrefix() Returns the prefix matching a specified namespace URI No 1 No Yes
normalize() Puts all text nodes underneath a node (including attributes) 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 5 1 9 Yes
removeChild() Removes a child node 5 1 9 Yes
replaceChild() Replaces a child node 5 1 9 Yes
setUserData(key,data,handler) Associates an object to a key on a node     No Yes

prev next

Learn XML with <oXygen/> XML Editor - Free Trial!

oXygen - Probably The World's Best XML Editor   

oXygen helps you learn to define, edit, validate and transform XML documents. Supported technologies include XML Schema, DTD, Relax NG, XSLT, XPath, XQuery, CSS.

Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!

Do you have any XML related questions? Get free answers from the oXygen XML forum and from the video demonstrations.

Download a FREE 30-day trial today!

E Components
$15 Domain Name
Save $20 / year!
Buy UK Domain Names
Register Domain Names
Cheap Domain Names
Cheap Web Hosting
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Website Templates
Flash Templates
Website Builder
Internet Business Opportunity
Custom Programming
FREE Trial or Demo
Web Content Manager
Forms,Web Alerts,RSS
Download XML editor
FREE Flash Website
FREE Web Templates
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
Home HOME or Top of Page Validate   Validate   W3C-WAI level A conformance icon Printer Friendly  Printer Friendly

W3Schools is for training only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user.
While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright 1999-2009 by Refsnes Data. All Rights Reserved.