var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") ;
xmlDoc.async=false;
xmlDoc.load("./MyTest/source/xml/heyi.xml");
//载入后声明根节点
var rootElement=xmlDoc.documentElement;
//看下根节点的name
alert(rootElement.nodeName);
//创建Node
var newEmploye=xmlDoc.createElement('NewNode_WuGui');
xmlDoc.async=false;
xmlDoc.load("./MyTest/source/xml/heyi.xml");
//载入后声明根节点
var rootElement=xmlDoc.documentElement;
//看下根节点的name
alert(rootElement.nodeName);
//创建Node
var newEmploye=xmlDoc.createElement('NewNode_WuGui');
http://www.aspcool.com/lanmu/browse.asp?bbsuser=xml
如果验证的内容一样,哪有什么区别呢?
在生成之前验证就是为了确保xml是正确的,如果通过验证后还有错,那还干吗要验证呀。
这点问题纠缠半天,值不值呀!
Indicates whether the parser should validate this document.Res
Boolean. The property is read/write. If True, it validates during parsing. If False, it parses only for well-formed XML. The default is True.This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).[Script]
Script Syntax
boolValue = oXMLDOMDocument.validateOnParse;
objXMLDOMDocument.validateOnParse = boolValue;
Example
var xmlDoc = new ActiveXObject("Msxml2.DOMDocument");
xmlDoc.async = false;
xmlDoc.validateOnParse = true;
xmlDoc.load("books.xml");