用 createNode("element","nodename","namespace")

解决方案 »

  1.   

    createNode是XMLDocument的方法,我无法加到HTML页面中。
    <?xml:namespace prefix="newNS"/>是什么呀?算xml声明吗?如果是也应该是<?xml....?>这种形式呀!请指教!谢谢!
      

  2.   

    msdn上介绍了一个add方法,不过我没用过,不知道是不是你要的?
    add Method--------------------------------------------------------------------------------Creates a new namespace object and adds it to the collection.SyntaxoNamespace = namespaces.add(sNamespace, sUrn [, sUrl])
    ParameterssNamespace Required. String that specifies the name of the namespace. 
    sUrn Required. String that specifies the Uniform Resource Name (URN) of the namespace to create. 
    sUrl Optional. String that specifies the URL of the element behavior to import into the namespace. Specifying this parameter is the same as calling the doImport method.  Return ValueReturns a namespace object.
      

  3.   

    请问这是从什么地方copy来的呀?namespace collection是用于什么地方的呀?
      

  4.   

    我已经搞定了这个问题了:
    先创建元素:
    var objElement = document.createElement("<newNS:element/>");
    document.body.appendChild(objElement);
    ....//不断创建元素
    document.body.innerHTML += "<?xml:namespace prefix='newNS'/>"; //最后加一个名称空间申明即可。不过我只知其然,而不知所以然,哎,还是郁闷中......???