簡體   English   中英

如何在BizTalk中處理此XML

[英]How to handle this XML in BizTalk

我正在傳遞大量XML,以便在BizTalk中進行處理。 xml主要采用以下形式:

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

但是,名稱值對有時會變得更復雜,看起來像這樣:

 <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>

我嘗試過通過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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM