当前位置: 首页 > 网络学院 > XML相关教程 > XML DOM > DOM Node

XML DOM
DOM Attribute
DOM Text
DOM CDATA
DOM Comment
DOM HttpRequest
DOM ParseError
DOM 校验器
DOM 介绍
DOM 摘要
DOM 案例
DOM 节点树
DOM 访问节点树
DOM 节点信息
DOM 文档执行
DOM 节点导航

XML DOM 中的 DOM Node


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-01   浏览: 787 ::
收藏到网摘: n/a

The Node object is the primary data type for the entire DOM.
节点对象是整个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.
这里的节点可以是:元素节点、属性节点、文本节点以及所有在“Node types[节点类型]”这章中所提到的所有类型的节点。

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.
注意:尽管所有的对象都继承了用以处理子类节点或父类节点的节点属性或节点对象,但是并不是所有的对象都可以包含子类或是父类。举个例子来说,文本节点中可能不包含子类,所以将子类节点添加到文本节点中可能会导致一个DOM错误。

IE: Internet Explorer, F: Firefox[火狐], O: Opera, W3C: World Wide Web Consortium (Internet Standard) | 万维网联盟(互联网标准)

Node Object Properties
节点对象属性

Properties
属性
Description
描述
IE F O W3C
baseURI Returns the absolute base URI of a node
返回一个节点的绝对基准URL
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
返回一个节点的命名空间URI
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
返回当前节点及其从属类节点的文本。仅IE支持
5 No No No
xml Returns the XML of a node and its descendants. IE-only property
返回当前节点及其从属类节点的XML。仅IE支持
5 No No No

Node Object Methods
节点对象方法

Methods
方法
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
返回一个DOM对象,此对象可执行带有指定特性和版本的专门的API
    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
返回与此节点上的某个键相关联的对象。此对象必须首先通过使用相同的键来调用setUserData被设置到此节点。
    No Yes
hasAttributes() Returns true if a node has any attributes, otherwise it returns false
假如某节点有任何的属性,则返回ture。否则返回false。
5 1 9 Yes
hasChildNodes() Returns true if a node has any child nodes, otherwise it returns false
假如某个节点拥有任何子节点,则返回true。否则返回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
返回是否指定的namespaceURI为默认
    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
返回匹配某个指定前缀的命名空间URI
No 1 No Yes
lookupPrefix()

Returns the prefix matching a specified namespace URI
返回匹配某个指定命名空间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
把某个节点(包括属性节点)下的所有文本节点放置到一个“标准”的格式中,其中只有结构(比如元素、注释、处理指令、CDATA区段以及实体引用)来分隔文本节点,例如,既没有相邻的文本节点,也没有空的文本节点。
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

 

评论 (0) All

登陆 | 还没注册?