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

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 309 ::
收藏到网摘: 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

登陆 | 还没注册?