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

XML DOM
DOM 节点
DOM 节点列表
DOM 解析
DOM 遍历节点树
DOM Mozilla 和 IE
DOM 获取节点
DOM 设置节点
DOM 删除节点
DOM 更换节点
DOM 建立节点
DOM 添加节点
DOM 克隆节点
DOM 节点类型
DOM Node
DOM NodeList
DOM NamedNodeMap
DOM Document
DOM DocumentType
DOM ProcessingInstr
DOM Element

XML DOM 中的 DOM 案例


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

XML DOM Parsing
XML DOM 解析

The XML file used in the examples below: note.xml
我们将在案例中使用下面这个XML文件:note.xml

Parse an XML file - Crossbrowser example
解析一个XML文件 - 跨浏览器案例

Parse an XML string - Crossbrowser example
解析一个XML字符串 - 跨浏览器案例

Examples explained
案例说明


XML DOM Traversing Nodes
XML DOM 穿越节点

The XML file used in the examples below: note.xml
我们将在案例中使用下面这个XML文件:note.xml

Traverse a node tree
穿越一个节点树

Examples explained
案例说明


XML DOM Get Nodes
XML DOM 获取节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Use getElementsbyTagname()
使用getElementsbyTagname()

Use getAttribute()
使用getAttribute()

Use getNamedItem()
使用getNameItem()

Examples explained
案例说明


XML DOM Set Nodes
XML DOM设置节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Set a new attribute and attribute value
设置一个全新的属性和属性值

Create a new attribute node
创建一个全新的属性节点

Change an attribute's value
改变一个属性值

Change an item's value
改变一个项的值

Examples explained
案例说明


XML DOM Remove Nodes
XML DOM 删除节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Remove an element
删除一个元素

Remove text from a text node
删除一个文本节点中的文本

Remove an attribute
删除一个属性

Use removeAttributeNode()
使用removeAttributeNode()

Examples explained
案例说明


XML DOM Replace Nodes
XML DOM 替代节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Replace a node in a nodelist
替代节点列表中的一个节点

Replace data in a text node
替代文本节点中的数据

Examples explained
案例说明


XML DOM Create Nodes
XML DOM 创建节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Create an element node
创建一个元素节点

Create an attribute node
创建一个属性节点

Create a text node
创建一个文本节点

Create a CDATA section node
创建一个CDATA片断节点

Create a comment node
创建一个注释节点

Examples explained
案例说明


XML DOM Add Nodes
XML DOM 添加节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Add a node to the end of a node list
将一个节点添加到节点列表的末尾

Add a node before a specific node
将一个节点添加到指定节点的前面

Set a new attribute and attribute value
设置一个全新的属性和属性值

Insert data into a text node
将数据插入一个文本节点中

Examples explained
案例说明


XML DOM Clone Nodes
XML DOM 克隆节点

In the examples below, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有案例中,我们将使用“books.xml”文件以及JavaScript 函数“loadXMLDoc()”。

Copy a node and add it to the node list
复制一个节点并把它添加到节点列表中

Examples explained
案例说明

评论 (0) All

登陆 | 还没注册?