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
如何在BizTalk中处理此XML_Xml_Xsd_Schema_Biztalk_Biztalk 2010 - Fatal编程技术网

如何在BizTalk中处理此XML

如何在BizTalk中处理此XML,xml,xsd,schema,biztalk,biztalk-2010,Xml,Xsd,Schema,Biztalk,Biztalk 2010,我正在被传递一大块XML,以便在BizTalk中进行处理。xml的主要形式如下: <FieldItem> <Name>EmploymentStatus</Name> <Value xsi:type="xsd:string">1</Value> </FieldItem> 就业状况 1. 但是,有时名称-值对会变得更复杂,如下所示: <FieldItem> <Name&g

我正在被传递一大块XML,以便在BizTalk中进行处理。xml的主要形式如下:

<FieldItem>
    <Name>EmploymentStatus</Name>
    <Value xsi:type="xsd:string">1</Value>
</FieldItem>

就业状况
1.
但是,有时名称-值对会变得更复杂,如下所示:

 <FieldItem>
        <Name>EducationAndQualifications</Name>
        <Value xsi:type="RepeatingFieldArray">
            <Fields>
                <RepeatingField>
                    <Items>
                        <FieldItem>
                            <Name>Qualification</Name>
                            <Value xsi:type="xsd:string">umbraco</Value>
                        </FieldItem>
                        <FieldItem>
                            <Name>Establishment</Name>
                            <Value xsi:type="xsd:string">IBM</Value>
                        </FieldItem>
                        <FieldItem>
                            <Name>DateAchieved</Name>
                            <Value xsi:type="xsd:string">June 2011</Value>
                        </FieldItem>
                    </Items>
                </RepeatingField>
            </Fields>
        </Value>
    </FieldItem>

教育和资格
资格
翁布拉科
编制
国际商用机器公司
达到日期
2011年6月
我曾尝试通过BizTalks生成的项目向导生成一个模式,但它无法处理类型的变化以及可能存在或不存在的额外重复字段

因此,我正在寻求有关这方面最佳前进方式的建议/指导。是否可以创建BizTalk要处理的架构?或者,我现在喜欢的解决方案是,我应该创建一个自定义管道组件,将其拆分为单独的消息吗

谢谢你抽出时间

更新

如果我创建以下架构:

<?xml version="1.0" encoding="utf-16" ?> 
<xsd:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="FormData">
    <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="FormName" type="xsd:string" /> 
          <xsd:element name="FormInstanceId" type="xsd:string" /> 
          <xsd:element name="Status" type="xsd:string" /> 
          <xsd:element name="Data">
              <xsd:complexType>
                  <xsd:sequence>
                      <xsd:element maxOccurs="unbounded" name="FieldItem">
                          <xsd:complexType>
                              <xsd:sequence>
                                  <xsd:element name="Name" type="xsd:string" /> 
                                  <xsd:element minOccurs="0" maxOccurs="unbounded" name="Value" nillable="true" type="xsd:anyType" /> 
                              </xsd:sequence>
                          </xsd:complexType>
                      </xsd:element>
                  </xsd:sequence>
              </xsd:complexType>
          </xsd:element>
      </xsd:sequence>
  </xsd:complexType>

我得到以下错误:

这是无效的xsi:type“RepeatingFieldArray”


因此,我仍然倾向于编写一些代码来解决这些问题……

我决定沿着自定义管道组件的路线,将重复数据提取到一个通用模式中,该模式也与通用重复键/值对相匹配。我添加了额外的字段,这样每个消息都可以通过它的节来识别。见下文:

<?xml version="1.0" encoding="utf-16" ?> 
    <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="https://BizTalk.Interfaces.INT034.Schemas.PropertySchema" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:annotation>
    <xs:appinfo>
    <b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
      <b:namespace prefix="ns0" uri="https://BizTalk.Interfaces.INT034.Schemas.PropertySchema" location=".\PropertySchema.xsd" /> 
      </b:imports>
      </xs:appinfo>
      </xs:annotation>
    <xs:element name="Root">
    <xs:annotation>
    <xs:appinfo>
    <b:properties>
      <b:property name="ns0:Interface" xpath="/*[local-name()='Root' and namespace-uri()='']/*[local-name()='Interface' and namespace-uri()='']" /> 
      </b:properties>
      </xs:appinfo>
      </xs:annotation>
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Interface" type="xs:string" /> 
      <xs:element name="Type" type="xs:string" /> 
      <xs:element name="FormName" type="xs:string" /> 
      <xs:element name="FormInstanceId" type="xs:string" /> 
      <xs:element name="Status" type="xs:string" /> 
    <xs:element name="Data">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" name="FieldItem">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Name" type="xs:string" /> 
      <xs:element name="Value" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>

我决定沿着自定义管道组件的路线,将重复数据提取到一个通用模式中,该模式也匹配常规重复键/值对。我添加了额外的字段,这样每个消息都可以通过它的节来识别。见下文:

<?xml version="1.0" encoding="utf-16" ?> 
    <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="https://BizTalk.Interfaces.INT034.Schemas.PropertySchema" attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:annotation>
    <xs:appinfo>
    <b:imports xmlns:b="http://schemas.microsoft.com/BizTalk/2003">
      <b:namespace prefix="ns0" uri="https://BizTalk.Interfaces.INT034.Schemas.PropertySchema" location=".\PropertySchema.xsd" /> 
      </b:imports>
      </xs:appinfo>
      </xs:annotation>
    <xs:element name="Root">
    <xs:annotation>
    <xs:appinfo>
    <b:properties>
      <b:property name="ns0:Interface" xpath="/*[local-name()='Root' and namespace-uri()='']/*[local-name()='Interface' and namespace-uri()='']" /> 
      </b:properties>
      </xs:appinfo>
      </xs:annotation>
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Interface" type="xs:string" /> 
      <xs:element name="Type" type="xs:string" /> 
      <xs:element name="FormName" type="xs:string" /> 
      <xs:element name="FormInstanceId" type="xs:string" /> 
      <xs:element name="Status" type="xs:string" /> 
    <xs:element name="Data">
    <xs:complexType>
    <xs:sequence>
    <xs:element maxOccurs="unbounded" name="FieldItem">
    <xs:complexType>
    <xs:sequence>
      <xs:element name="Name" type="xs:string" /> 
      <xs:element name="Value" type="xs:string" /> 
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>