2011-05-31 1 views
2

ヒヤス。フラットファイルで私たちに注文を送る顧客があります。実際にファイルに複雑さはありませんが、ファイルごとにいくつかの矛盾があります。Biztalkスキーマ変数の区切り文字列の列の数は許可されていますか?

ファイルの形式は次のようである:

1,2,3 [CRLF]
1,2,3 [CRLF]

いいえ問題がから、その構造体の周りにスキーマを作成します新しい列を追加することが時々あります。

1,2,3、 [CRLF]
1,2,3、 [CRLF]

残念ながら、彼らはしないでください、私たちが期待にノウサギ後方ように、その変更のカスケード3列と4列の両方の形式をサポートします。どちらのフォーマットも同じパイプラインを経由する可能性があるので、別々のスキーマ/パイプラインを作成するオプションはありません。彼らは常に行の最後に新しいフィールドを追加するので、少なくとも一貫性があります。

私が考えることができると思うのは、どのスキーマが適用され、それに応じてパイプラインコンポーネントが適用されるかを把握することです。しかし、その道を行く前に、単一のフラットファイルスキーマを使用するようにしました(オプションの列のminOccursプロパティを0に設定しようとしましたが、それは問題ありません)。

アドバイスを事前にいただきありがとうございます。

+1

レコードの前にさまざまな種類のレコードを識別するものはありますか?存在する場合は、タグ識別子を使用できます。 – aceinthehole

答えて

0

1つの方法は、サポートする必要がある異なるバージョンのスキーマをインポートすることで、「外部」スキーマとスキーマを定義することです。 「外部」スキーマには、インポートされたバージョンスキーマへの参照を含むchoiceブロックが提供されます。

次のバージョンを追加する必要がある場合は、新しいスキーマをインポートしてchoiceに追加するだけです。

難しい部分はもちろん、さまざまなバージョンの処理方法を決定する方法です。おそらく、最も簡単な方法は、扱う必要のあるすべての専用タイプのマップを作成することです。一方で、「最新かつ最高の」内部メッセージタイプを拡張し、メッセージの内容に基づいて決定することができます。

"外側" スキーマ

<!-- language: xml-schema --> 

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:ns0="http://ACME.Version_001" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Outer" xmlns:ns1="http://ACME.Version_002" targetNamespace="http://ACME.Outer" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:import schemaLocation=".\version_002.xsd" namespace="http://ACME.Version_002" /> 
    <xs:import schemaLocation=".\version_001.xsd" namespace="http://ACME.Version_001" /> 
    <xs:annotation> 
     <xs:appinfo> 
      <b:schemaInfo standard="Flat File" root_reference="Root" /> 
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> 
      <b:references> 
       <b:reference targetNamespace="http://ACME.Version_001" /> 
       <b:reference targetNamespace="http://ACME.Version_002" /> 
      </b:references> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Root"> 
     <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" sequence_number="1" child_delimiter_type="hex" child_order="postfix" child_delimiter="0x0D 0x0A" /> 
      </xs:appinfo> 
     </xs:annotation> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:choice minOccurs="1"> 
        <xs:element ref="ns0:Version_001"> 
         <xs:annotation> 
          <xs:appinfo> 
           <b:recordInfo sequence_number="1" structure="delimited" /> 
          </xs:appinfo> 
         </xs:annotation> 
        </xs:element> 
        <xs:element ref="ns1:Version_002"> 
         <xs:annotation> 
          <xs:appinfo> 
           <b:recordInfo sequence_number="2" structure="delimited" /> 
          </xs:appinfo> 
         </xs:annotation> 
        </xs:element> 
       </xs:choice> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

インポートされたスキーマ "Version_001"

<!-- language: xml-schema --> 

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_001" targetNamespace="http://ACME.Version_001" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
     <xs:appinfo> 
      <b:schemaInfo standard="Flat File" root_reference="Version_001" /> 
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Version_001"> 
     <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," /> 
      </xs:appinfo> 
     </xs:annotation> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="Col1" type="xs:string" /> 
       <xs:element name="Col2" type="xs:string" /> 
       <xs:element name="Col3" type="xs:string" /> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

インポートされたスキーマ "Version_002"

<!-- language: xml-schema --> 

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://ACME.Version_002" targetNamespace="http://ACME.Version_002" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
     <xs:appinfo> 
      <b:schemaInfo standard="Flat File" root_reference="Version_002" /> 
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Version_002"> 
     <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" child_delimiter_type="char" child_order="infix" rootTypeName="Version_001" child_delimiter="," /> 
      </xs:appinfo> 
     </xs:annotation> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="Col1" type="xs:string" /> 
       <xs:element name="Col2" type="xs:string" /> 
       <xs:element name="Col3" type="xs:string" /> 
       <xs:element name="Col4" type="xs:string" /> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

(可読性のために一部の省略時の属性は省略されています)

+0

Filburtに感謝します。「選択肢」スキーマは、最高のソルーションのように聞こえます。 –

関連する問題