非常教程

HTML DOM参考手册

XML DOM – Document 对象

XML DOM – Document 对象

XML DOM - Document 对象


Document 对象代表整个 XML 文档。


Document 对象

Document 对象是文档树的根,并为我们提供对文档数据的最初(或最顶层)的访问入口。

由于元素节点、文本节点、注释、处理指令等均无法存在于文档之外,Document 对象也提供了创建这些对象的方法。Node 对象提供了一个 ownerDocument 属性,此属性可把它们与在其中创建它们的 Document 关联起来。

Document 对象属性

属性 描述
async 规定 XML 文件的下载是否应当被异步处理。
childNodes 返回文档的子节点的节点列表。
doctype 返回与文档相关的文档类型声明(DTD,全称 Document Type Declaration)。
documentElement 返回文档的根节点。
documentURI 设置或返回文档的位置。
domConfig 返回 normalizeDocument() 被调用时所使用的配置。
firstChild 返回文档的第一个子节点。
implementation 返回处理该文档的 DOMImplementation 对象。
inputEncoding 返回用于文档的编码方式(在解析时)。
lastChild 返回文档的最后一个子节点。
nodeName 返回节点的名称(根据节点的类型)。
nodeType 返回节点的节点类型。
nodeValue 设置或返回节点的值(根据节点的类型)。
strictErrorChecking 设置或返回是否强制进行错误检查。
xmlEncoding 返回文档的 XML 编码。
xmlStandalone 设置或返回文档是否为 standalone。
xmlVersion 设置或返回文档的 XML 版本。

Document 对象方法

方法 描述
adoptNode(sourcenode) 从另一个文档向本文档选定一个节点,然后返回被选节点。
createAttribute(name) 创建带有指定名称的属性节点,并返回新的 Attr 对象。
createAttributeNS(uri,name) 创建带有指定名称和命名空间的属性节点,并返回新的 Attr 对象。
createCDATASection() 创建 CDATA 区段节点。
createComment() 创建注释节点。
createDocumentFragment() 创建空的 DocumentFragment 对象,并返回此对象。
createElement() 创建元素节点。
createElementNS() 创建带有指定命名空间的元素节点。
createEntityReference(name) 创建 EntityReference 对象,并返回此对象。
createProcessingInstruction(target,data) 创建一个 ProcessingInstruction 对象,并返回此对象。
createTextNode() 创建文本节点。
getElementById(id) 返回带有指定值的 ID 属性的元素。如果不存在这样的元素,则返回 null。
getElementsByTagName() 返回带有指定名称的所有元素的 NodeList。
getElementsByTagNameNS() 返回带有指定名称和命名空间的所有元素的 NodeList。
importNode(nodetoimport,deep) 从另一个文档向本文档选定一个节点。该方法创建源节点的一个新的副本。如果 deep 参数设置为 true,它将导入指定节点的所有子节点。 如果设置为 false,它将只导入节点本身。该方法返回被导入的节点。
normalizeDocument()
renameNode() 重命名元素或属性节点。

XML DOM – Document 对象

HTML DOM目录

1.XML DOM 教程
2.HTML DOM 教程
3.XML DOM – 节点列表和命名节点图
4.XML DOM 节点信息
5.XML DOM 访问节点
6.XML DOM 方法
7.XML DOM 加载函数
8.XML DOM 解析器
9.XML DOM – 节点
10.XML DOM 简介
11.XML DOM – 添加节点
12.XML DOM – 创建节点
13.XML DOM – 替换节点
14.XML DOM – 删除节点
15.XML DOM – 改变节点值
16.XML DOM – 获取节点值
17.XML DOM 浏览器差异
18.XML DOM – 遍历节点树
19.XML DOM – ProcessingInstruction 对象
20.XML DOM – DocumentType 对象
21.XML DOM – DocumentImplementation 对象
22.XML DOM – Document 对象
23.XML DOM – NamedNodeMap 对象
24.XML DOM – NodeList 对象
25.XML DOM – Node 对象
26.XML DOM – 节点类型
27.XML DOM – HttpRequest 对象
28.XML DOM – 克隆节点
29.XML DOM nodeType 属性
30.XML DOM nodeName 属性
31.XML DOM nextSibling 属性
32.XML DOM namespaceURI 属性
33.XML DOM localName 属性
34.XML DOM lastChild 属性
35.XML DOM firstChild 属性
36.XML DOM childNodes 属性
37.XML DOM baseURI 属性
38.XML DOM compareDocumentPosition() 方法
39.XML DOM cloneNode() 方法
40.XML DOM appendChild() 方法
41.XML DOM textContent 属性
42.XML DOM previousSibling 属性
43.XML DOM prefix 属性
44.XML DOM parentNode 属性
45.XML DOM ownerDocument 属性
46.XML DOM nodeValue 属性
47.XML DOM replaceChild() 方法
48.XML DOM removeChild() 方法
49.XML DOM lookupPrefix() 方法
50.XML DOM lookupNamespaceURI() 方法
51.XML DOM isSameNode() 方法
52.XML DOM isEqualNode() 方法
53.XML DOM insertBefore() 方法
54.XML DOM hasChildNodes() 方法
55.XML DOM hasAttributes() 方法
56.XML DOM childNodes 属性
57.XML DOM async 属性
58.XML DOM removeNamedItem() 方法
59.XML DOM item() 方法
60.XML DOM getNamedItem() 方法
61.XML DOM length 属性
62.XML DOM item() 方法
63.XML DOM length 属性
64.XML DOM nodeName 属性
65.XML DOM lastChild 属性
66.XML DOM inputEncoding 属性
67.XML DOM implementation 属性
68.XML DOM firstChild 属性
69.XML DOM documentURI 属性
70.XML DOM documentElement 属性
71.XML DOM doctype 属性
72.XML DOM xmlVersion 属性
73.XML DOM xmlStandalone 属性
74.XML DOM xmlEncoding 属性
75.XML DOM strictErrorChecking 属性
76.XML DOM nodeValue 属性
77.XML DOM nodeType 属性
78.XML DOM getElementsByTagNameNS() 方法
79.XML DOM getElementsByTagName() 方法
80.XML DOM createTextNode() 方法
81.XML DOM createElementNS() 方法
82.XML DOM createElement() 方法
83.XML DOM createComment() 方法
84.XML DOM createCDATASection() 方法
85.XML DOM – HttpRequest 对象
86.XML DOM – Comment 对象
87.XML DOM – CDATASection 对象
88.XML DOM – Text 对象
89.XML DOM – Attr 对象
90.XML DOM – Element 对象
91.XML DOM renameNode() 方法
92.XML DOM 解析器错误
93.XML DOM Parse Error 对象
94.XML DOM attributes 属性
95.XML DOM systemId 属性
96.XML DOM name 属性
97.XML DOM internalSubset 属性
98.XML DOM entities 属性
99.XML DOM ownerDocument 属性
100.XML DOM nodeType 属性