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');

解决方案 »

  1.   

    龟:不想把xmldom的属性方法打上去了。累死了。找了个这个,自已看下就知道了。不过我还是觉得在生成xml之前来验证为上船策
    http://www.aspcool.com/lanmu/browse.asp?bbsuser=xml
      

  2.   

    不用遍历这个文档吧,我要验证的是xml是否符合schema,生成之前验证是另外一回事,如果生成xml有错,怎么验证啊,你给的这个网址我早看过了
      

  3.   

    生成之前的验证难道与生成后用schema验证的内容不同吗?!!
    如果验证的内容一样,哪有什么区别呢?
    在生成之前验证就是为了确保xml是正确的,如果通过验证后还有错,那还干吗要验证呀。
    这点问题纠缠半天,值不值呀!
      

  4.   

    validateOnParse Property
    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");
      

  5.   

    Oh, sorry. I forgot to tell you that "validateOnParse Property" has nothing to do with schema, but dtd, I think you should try dtd to verify your xml.