Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js libxmljs:如何使用xinclude?_Node.js_Xml_Xsd_Libxml Js - Fatal编程技术网

Node.js libxmljs:如何使用xinclude?

Node.js libxmljs:如何使用xinclude?,node.js,xml,xsd,libxml-js,Node.js,Xml,Xsd,Libxml Js,我尝试将libxmljs与nodejs一起使用。 在我的示例中,我想使用xi:include <ord:order xmlns:ord="http://example.org/ord" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd" xmlns:xi="http:

我尝试将libxmljs与nodejs一起使用。 在我的示例中,我想使用xi:include

    <ord:order  xmlns:ord="http://example.org/ord"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd"
      xmlns:xi="http://www.w3.org/2001/XInclude">
      <number>123ABBCC123</number>
      <customer>
        <name>Priscilla Walmsley</name>
        <number>15466</number>
      </customer>
      <items>
        <xi:include href="/Users/mar/ws_e/libxml/test/resources/chapter5prod.xml" />
      </items>
    </ord:order>
然后我得到一个错误:

Document {
  errors: [],
  validationErrors: 
    [ { Error: Element '{http://www.w3.org/2001/XInclude}include': This element is not expected. Expected is ( product ).
所以我的问题是如何在libxmljs中使用x:include

问候


Markus

见“XInclude不工作”:。谢谢。那么,您找到合适的工作环境了吗?我认为您不应该在libxmljs中使用XInclude。以其他方式组合XML文档的各个部分。
    var xsdDoc = libxml.parseXml(schemaSource);
    var xmlDocValid = libxml.parseXml(docSource);
    var xmlDocInvalid = libxml.parseXml(xml_invalid);
    xmlDocValid.validate(xsdDoc);

    console.dir(xmlDocValid);
    console.dir(xmlDocValid.validationErrors);
Document {
  errors: [],
  validationErrors: 
    [ { Error: Element '{http://www.w3.org/2001/XInclude}include': This element is not expected. Expected is ( product ).