xsd - How to define a Flat file schema for a record with a repeating sequence? -


i have positional flat file contains records repeating sequence, this;

token name label value label value label value label value .. 

the token identifies type of record, name name value, , label (10 positions) , value (50 positions) pairs can repeat not-fixed number of times (1..*).

i have defined flat file schema below; contains (1..*), label , value correct positional data:

repeating sequence schema

both label , value have minoccurs , maxoccurs of 1.

the problem have biztalk not seam able handle situation. when generate (native) instance schema following output:

token name        label     value                                              

(it generates single instance of label value).

when try read file has multiple occurrences of label value pairs (5), gives me following xml:

<file xmlns="http://schemas.demo/2015/01">     <repeatingrecord xmlns="">         <name>name</name>         <label>label</label>         <label>value</label>         <label>label</label>         <label>value</label>         <label>label</label>         <label>value</label>         <label>label</label>         <label>value</label>         <label>label</label>         <label>value</label>     </repeatingrecord> </file> 

so label tags, no value tags. contents of value parts placed wrongly in label tag.

i expect following xml:

<file xmlns="http://schemas.demo/2015/01">     <repeatingrecord xmlns="">         <name>name</name>         <label>label</label>         <value>value</value>         <label>label</label>         <value>value</value>         <label>label</label>         <value>value</value>         <label>label</label>         <value>value</value>         <label>label</label>         <value>value</value>     </repeatingrecord> </file> 

how can define flat file schema repeating sequence in record?

i have following schema:

<?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns="http://schemas.goudse.nl/irma/adapter/2015/01" xmlns:b="http://schemas.microsoft.com/biztalk/2003" attributeformdefault="unqualified" elementformdefault="unqualified" targetnamespace="http://schemas.goudse.nl/irma/adapter/2015/01" xmlns:xs="http://www.w3.org/2001/xmlschema">   <xs:annotation>     <xs:appinfo>       <b:schemainfo standard="flat file" root_reference="file" default_pad_char="0x20" pad_char_type="hex" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="true" generate_empty_nodes="false" allow_early_termination="true" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" document_type="asfbatchflatfileschema" version="2015.01" schema_type="document" default_child_order="postfix" child_delimiter_type="hex" default_child_delimiter="0x0d 0x0a" />       <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="file">     <xs:annotation>       <xs:appinfo>         <b:recordinfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="default" notes="een compleet bestand" />       </xs:appinfo>     </xs:annotation>     <xs:complextype>       <xs:sequence minoccurs="1" maxoccurs="1">         <xs:annotation>           <xs:appinfo>             <b:groupinfo sequence_number="0" />           </xs:appinfo>         </xs:annotation>         <xs:element minoccurs="1" maxoccurs="unbounded" name="repeatingrecord">           <xs:annotation>             <xs:appinfo>               <b:recordinfo structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" tag_name="token " notes="data behorende bij de schadebrief" sequence_number="1" />             </xs:appinfo>           </xs:annotation>           <xs:complextype>             <xs:sequence>               <xs:annotation>                 <xs:appinfo>                   <b:groupinfo sequence_number="0" />                 </xs:appinfo>               </xs:annotation>               <xs:element name="name" type="xs:string">                 <xs:annotation>                   <xs:appinfo>                     <b:fieldinfo justification="left" sequence_number="1" pos_length="12" pos_offset="6" pad_char_type="hex" pad_char="0x20" />                   </xs:appinfo>                 </xs:annotation>               </xs:element>               <xs:sequence minoccurs="1" maxoccurs="unbounded">                 <xs:annotation>                   <xs:appinfo>                     <b:groupinfo sequence_number="2" />                   </xs:appinfo>                 </xs:annotation>                 <xs:element minoccurs="1" maxoccurs="1" name="label" type="xs:string">                   <xs:annotation>                     <xs:appinfo>                       <b:fieldinfo justification="left" pos_length="10" pad_char_type="hex" pad_char="0x20" sequence_number="1" />                     </xs:appinfo>                   </xs:annotation>                 </xs:element>                 <xs:element minoccurs="1" maxoccurs="1" name="value" type="xs:string">                   <xs:annotation>                     <xs:appinfo>                       <b:fieldinfo justification="left" pos_length="50" pad_char_type="hex" pad_char="0x20" sequence_number="2" />                     </xs:appinfo>                   </xs:annotation>                 </xs:element>               </xs:sequence>             </xs:sequence>           </xs:complextype>         </xs:element>       </xs:sequence>     </xs:complextype>   </xs:element> </xs:schema> 

and following test data file (replaced spaces periods clarity, schema defines spaces padding).

token.name........label.....value.............................................label.....value.............................................label.....value.............................................label.....value.............................................label.....value............................................. 

update

what did not mention in question (for sake of simplicity) record used in flat file multiple kinds of different records, splitting record child-records not viable solution.

i able validate input top of post following, gets ont right track:

<?xml version="1.0" encoding="utf-16"?> <xs:schema xmlns="http://biztalk_server_project2.flatfileschema2" xmlns:b="http://schemas.microsoft.com/biztalk/2003" targetnamespace="http://biztalk_server_project2.flatfileschema2" 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="file" />     </xs:appinfo>   </xs:annotation>   <xs:element name="file">     <xs:annotation>       <xs:appinfo>         <b:recordinfo structure="positional" 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 name="file_child1" type="xs:string">           <xs:annotation>             <xs:appinfo>               <b:fieldinfo justification="left" pos_offset="0" pos_length="6" sequence_number="1" />             </xs:appinfo>           </xs:annotation>         </xs:element>         <xs:element name="file_child2" type="xs:string">           <xs:annotation>             <xs:appinfo>               <b:fieldinfo justification="left" pos_offset="0" pos_length="5" sequence_number="2" />             </xs:appinfo>           </xs:annotation>         </xs:element>         <xs:element maxoccurs="unbounded" name="file_child3">           <xs:annotation>             <xs:appinfo>               <b:recordinfo structure="positional" sequence_number="3" 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 name="file_child3_child1" type="xs:string">                 <xs:annotation>                   <xs:appinfo>                     <b:fieldinfo justification="left" pos_offset="0" pos_length="6" sequence_number="1" />                   </xs:appinfo>                 </xs:annotation>               </xs:element>               <xs:element name="file_child3_child2" type="xs:string">                 <xs:annotation>                   <xs:appinfo>                     <b:fieldinfo justification="left" pos_offset="0" pos_length="6" sequence_number="2" />                   </xs:appinfo>                 </xs:annotation>               </xs:element>             </xs:sequence>           </xs:complextype>         </xs:element>       </xs:sequence>     </xs:complextype>   </xs:element> </xs:schema> 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -