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

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 中的 xml 属性


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

Definition and Usage
定义与用法

The xml property returns the XML of a node and its descendants.
xml属性可以返回XML的节点以及它的子节点

Syntax
语法

elementNode.xml


Tips and Notes
提示与注意点

Note: This property is Internet Explorer-only!
注意:这个属性只有在IE中才有效果!


In all examples, we will use the XML file books.xml, and the JavaScript function loadXMLDoc().
在所有的举例中,我们都将使用XML文档 books.xml,以及JS函数 loadXMLDoc()

Example
举例

The following code fragment displays the XML of the first <book> element in the XML document:
下面的代码段可以显示在XML文档中第一个<book>元素:

xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book")[0];
document.write("<xmp>" + x.xml + "</xmp>");

Output:
输出:

<book category="COOKING">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>


Try-It-Yourself Demos
尝试与演示

xml - Display the XML of an node
xml -可用来显示XML中的一个节点

评论 (0) All

登陆 | 还没注册?