2013-10-24 71 views
0

我有幾個配置文件,可能有或可能不具有某些屬性。Biztalk平面文件架構嚮導:解析配置文件

例如:

Property1 : value1 
Property2 : value2 
. 
junk text 
junk text : line count between useful data varies in every file. 
junk text 
. 
Property3 : value3 //optional 

有沒有辦法只能通過檢索僅標籤標識的屬性,並跳過所有的垃圾在兩者之間?

到目前爲止,我無法弄清楚如何跳過垃圾。 「忽略」後,「記錄順序」

回答

1

是的,像下面,你告訴它來尋找特定的標籤,並有記錄,沒有標籤的消耗那些你不感興趣,只允許。

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns="http://Scratch.Junk" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.Junk" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:annotation> 
    <xs:appinfo> 
     <b:schemaInfo standard="Flat File" root_reference="Root" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="complexity" 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" /> 
     <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="Root"> 
    <xs:annotation> 
     <xs:appinfo> 
     <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="postfix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" /> 
     </xs:appinfo> 
    </xs:annotation> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:annotation> 
      <xs:appinfo> 
      <b:groupInfo sequence_number="0" /> 
      </xs:appinfo> 
     </xs:annotation> 
     <xs:element name="Property1"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="Property1 :" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <b:groupInfo sequence_number="0" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element name="value1" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo sequence_number="1" justification="left" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element name="Property2"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="Property2 :" sequence_number="2" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <b:groupInfo sequence_number="0" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element name="value2" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo sequence_number="1" justification="left" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element minOccurs="0" maxOccurs="unbounded" name="Junk"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo sequence_number="3" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <b:groupInfo sequence_number="0" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element name="JunkValue" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo sequence_number="1" justification="left" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element minOccurs="0" name="Property3"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="Property3 :" sequence_number="4" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <b:groupInfo sequence_number="0" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element name="value3" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo sequence_number="1" justification="left" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     <xs:element minOccurs="0" maxOccurs="unbounded" name="MoreJunk"> 
      <xs:annotation> 
      <xs:appinfo> 
       <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="5" /> 
      </xs:appinfo> 
      </xs:annotation> 
      <xs:complexType> 
      <xs:sequence> 
       <xs:annotation> 
       <xs:appinfo> 
        <b:groupInfo sequence_number="0" /> 
       </xs:appinfo> 
       </xs:annotation> 
       <xs:element name="JunkValue" type="xs:string"> 
       <xs:annotation> 
        <xs:appinfo> 
        <b:fieldInfo sequence_number="1" justification="left" /> 
        </xs:appinfo> 
       </xs:annotation> 
       </xs:element> 
      </xs:sequence> 
      </xs:complexType> 
     </xs:element> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema>