BizTalk Xml 汇编程序 HRESULT 80131941

BizTalk Xml Assembler HRESULT 80131941

我正在使用 BizTalk 2013 R2。我有一个输入文件需要反汇编:

<Root xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe">
  <DOC xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument">
    <Id>1</Id>
    <Description>Description 001</Description>
  </DOC>
  <DOC xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument">
    <Id>2</Id>
    <Description>Description 002</Description>
  </DOC>
  <DOC xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument">
    <Id>3</Id>
    <Description>Description 003</Description>
  </DOC>
</Root>

这是我的信封架构:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:ns0="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:import schemaLocation=".\schDocument.xsd" namespace="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument" />
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo is_envelope="yes" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
      <b:references>
        <b:reference targetNamespace="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument" />
      </b:references>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo body_xpath="/*[local-name()='Root' and namespace-uri()='http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe']" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="ns0:DOC" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

这是我的文档架构:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" elementFormDefault="qualified" targetNamespace="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="DOC">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Id" type="xs:int" />
        <xs:element name="Description" type="xs:string" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

使用 XmlDasm 的反汇编阶段运行良好,我的信封模式文件使用 xml 输入文件实例进行验证。我的问题是用相同的模式文件重新组装反汇编文件(具有 1 个或多个实例)。所以这是我的反汇编文件:

<DOC xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schDocument">
  <Id>1</Id>
  <Description>Description 001</Description>
</DOC>

命令如下:

"c:\Program Files (x86)\Microsoft BizTalk Server 2013 R2\SDK\Utilities\PipelineTools\XmlAsm.exe" ..\Xml\DOC1.xml -es ..\Schemas\schEnveloppe.xsd -ds ..\Schemas\schDocument.xsd -c

错误信息:

Error
Source:         XML assembler
Message:        The 'http://Test.XmlDasmAsm.BIZ.Schemas.schDocument:DOC' element is not declared.
HRESULT:        80131941

我认为我的问题出在我的模式中,但所有示例文件都适用于所有模式。

不幸的是,关于 xmlasm 的文档很差。有什么想法吗?

不能对反汇编程序和汇编程序使用相同的信封模式。问题中显示的架构对于反汇编是正确的,但对于组装,这里是 shema :

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo is_envelope="yes" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo body_xpath="/*[local-name()='Root' and namespace-uri()='http://Test.XmlDasmAsm.BIZ.Schemas.schEnveloppe']" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:any />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>