有没有一种方法可以处理/忽略biztalk中收到的xml文件中的内联xsd?

时间:2019-05-31 10:06:08

标签: xsd biztalk biztalk-schemas

客户发送包含xml客户数据的文件。问题在于它还包含他们使用的xsd。在biztalk中设置源模式时是否有办法使其在忽略xsd的同时进行验证?

我尝试为其添加节点,但是由于某些名称空间错误而无法验证,并且它一直在寻找包含客户数据的第一个元素节点

<Root>
  <xsd:schema id="Root" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:element name="Root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="Data" minOccurs="0" maxOccurs="unbounded">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="number" type="xsd:int"/>
                <xsd:element name="name">
                    <xsd:simpleType>
                      <xsd:restriction base="xsd:string">
                        <xsd:maxLength value="60"/>
                      </xsd:restriction>
                    </xsd:simpleType>
                </xsd:element>
                <xsd:element name="address">
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                      <xsd:maxLength value="30"/>
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:element>
                <xsd:element name="Zip">
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                      <xsd:maxLength value="5"/>
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:element>
                <xsd:element name="telephone">
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                      <xsd:maxLength value="60"/>
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:element>
                <xsd:element name="custNumber">
                  <xsd:simpleType>
                    <xsd:restriction base="xsd:string">
                      <xsd:maxLength value="11"/>
                    </xsd:restriction>
                  </xsd:simpleType>
                </xsd:element>
                <xsd:element name="branchnumber" type="xsd:int"/>
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
        <xsd:anyAttribute namespace="http://www.w3.org/XML/1998/namespace" processContents="lax"/>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>

    <Data>
        <number>12345</number>
        <name>Scrooge McDuck</name>
        <address>Address 1</adresse>
        <Zip>0000</Zip>
        <telephone>1234563290</telephone>
        <custNumber>123324</custNumber>
        <branchnumber>0</branchnumber>
    </Data>
    <Data>
        <number>23456</number>
        <name>Donald Duck</name>
        <address>Address 4</adresse>
        <Zip>4625</Zip>
        <telephone>1234567890</telephone>
        <custNumber>123321</custNumber>
        <branchnumber>0</branchnumber>
    </Data>
</Root>

1 个答案:

答案 0 :(得分:0)

I don't think this would actually cause a problem.

First, don't bother validating at runtime, no one ever does this and it's never mattered.

The schema should only contain the content nodes, this will work just fine in the Mapper, Properties etc.

Since you're not validating, provided the Schema is valid xml, it'll just go along for the ride and will be ignored.

To Validate in VS, just take the Schema nodes out.