2013-07-14 20 views
1

我必須使用Biztalk將其轉換爲UBL的平面文件。biztalk中的Flatfile中的可選行

一切都很好,直到我到達平面文件的末尾。

其中一個看起來像這樣

RZ0100120400R;RZ01-00120400;RAZER MAMBA 2012 EL;2;739,77;2013.06.12 
RZ0100580100R;RZ01-00580100;RAZER NAGA 2012;1;482,38;2013.06.12 
RZ0400590100R;RZ04-00590100;RAZER TIAMAT EXPERT;2;605,3;2013.06.12 

TOTA;L FAKTURAVÆRDI;EKSKL. MOMS;;18.667,30; 

另外一個是這樣的:

382908;382908;Anymode Samsung Gal;4;88,87;2013.06.13 
382909;382909;Anymode Samsung Gal;4;88,87;2013.06.13 
ANYMODESAMSUN;ANYMODE SAMSU;ANYMODE ANYMODE SAM;4;88,87;2013.06.13 
;;;;; 
TOTA;L FAKTURAVÆRDI;EKSKL. MOMS;;8.116,31; 

如果我做一個模式爲一個其他人會無法正常工作。所以我的問題是。 如何製作一個可以同時採用它們的模式,而沒有問題? 我只是需要一些東西來調整第一個例子中的空行。 我正在使用Visual Studio平面文件嚮導。

回答

1

您可以將有問題的記錄/行及其所有子字段元素設置爲可選(最小出現= 0)。

示例模式(與提供的樣本都平面文件測試...):

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns="http://SampleProject.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://SampleProject.FlatFileSchema1" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
    <xs:appinfo> 
     <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" /> 
     <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Root" /> 
    </xs:appinfo> 
    </xs:annotation> 
    <xs:element name="Root"> 
    <xs:annotation> 
     <xs:appinfo> 
     <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" /> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:annotation> 
      <xs:appinfo> 
      <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
      </xs:appinfo> 
     </xs:annotation> 
     <xs:element minOccurs="0" maxOccurs="unbounded" name="line"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter=";" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element minOccurs="0" name="Child1" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="1" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element minOccurs="0" name="Child2" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="2" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element minOccurs="0" name="Child3" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="3" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element minOccurs="0" name="Child4" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="4" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element minOccurs="0" name="Child5" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="5" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
       <xs:element minOccurs="0" name="Child6" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo justification="left" sequence_number="6" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

希望幫助!

問候函
Philipp