Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Flat file to XML
- This topic has 1 reply, 1 voice, and was last updated 9 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
January 8, 2007 at 1:17 PM #17152
I have a flat pipe delimited file as below:
HRD|Test1|Name|
BDY|Body|Name
MSG|Message|Name
DOC|HRD|Test1|Name|
BDY|Body|Name
MSG|Message|NameThe HRD, BDY, MSG are records can be repeated to n-times maximum and zero
occurrences.
While DOC record which is the Document record contains other records as
CDATA, which contain all records HRD, BDY… as text files.Below are schema layout:
<Schema>
<Root>
<HRD>
<Field1></Field1>
<Field2></Field2>
</HRD>
<BDY>
<Field1></Field1>
<Field2></Field2>
</BDY>
<MSG>
<Field1></Field1>
<Field2></Field2>
</MSG>
<DOC>
<Field1>HRD|Test1|Name| BDY|Body|Name MSG|Message|Name
</Field1>
</DOC>
</Root>
</Schema>As I config properties of schema below:
Schema – Flat file extension, Allow Early Termination, Parser Optimization =
Complexity
Root – Default Child Order, Hexadecimal, 0x0d (Child Order, Type,
Delimiter). Group order type as Sequence.
HRD – Default Child Order, Hexadecimal, 0x7c (Child Order, Type, Delimiter),
Min Occurs = 0 and Max Occurs = Unbounded. Same configurations for BDY and
MSG record. The DOC record has max occur is one.Here is my issue.
1. If my flat file miss one of the records it will faild the validation,
error description would be like "unexpected end of stream while looking for ".
How do I fix this??? Please help
Thank you,B
-
January 11, 2007 at 6:25 AM #17203
Here is the schema created:
<?xml version="1.0" encoding="utf-16" ?>
– <xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
– <xs:annotation>
– <xs:appinfo>
<b:schemaInfo count_positions_by_byte="false" parser_optimization="speed"
lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true"
allow_early_termination="false" 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" />
</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="true"
sequence_number="1" child_order="default" 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 minOccurs="0" maxOccurs="1" name="HDR">
– <xs:annotation>
– <xs:appinfo>
<b:recordInfo sequence_number="1" structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
child_delimiter_type="hex" child_delimiter="0x7C" tag_name="HDR"
child_order="default" />
</xs:appinfo>
</xs:annotation>
– <xs:complexType>
– <xs:sequence>
– <xs:annotation>
– <xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
– <xs:element name="Field1" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="1" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
– <xs:element name="Field2" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
– <xs:element minOccurs="0" maxOccurs="unbounded" name="BDY">
– <xs:annotation>
– <xs:appinfo>
<b:recordInfo sequence_number="2" structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
child_delimiter_type="hex" child_order="default" child_delimiter="0x7C"
tag_name="BDY" />
</xs:appinfo>
</xs:annotation>
– <xs:complexType>
– <xs:sequence>
– <xs:annotation>
– <xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
– <xs:element name="Field1" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="1" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
– <xs:element name="Field2" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
– <xs:element minOccurs="0" maxOccurs="1" name="MSG">
– <xs:annotation>
– <xs:appinfo>
<b:recordInfo sequence_number="3" structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
tag_name="MSG" child_order="default" child_delimiter_type="hex"
child_delimiter="0x7C" />
</xs:appinfo>
</xs:annotation>
– <xs:complexType>
– <xs:sequence>
– <xs:annotation>
– <xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
– <xs:element name="Field1" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="1" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
– <xs:element name="Field2" type="xs:string">
– <xs:annotation>
– <xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
– <xs:element minOccurs="0" maxOccurs="1" name="DOC">
– <xs:annotation>
– <xs:appinfo>
<b:recordInfo sequence_number="4" structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
child_order="default" child_delimiter_type="hex" child_delimiter="0x7C"
tag_name="DOC" />
</xs:appinfo>
</xs:annotation>
– <xs:complexType>
– <xs:sequence>
– <xs:annotation>
– <xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
– <xs:element name="Field1" 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>And the test file:
HDR|File|A Header test
BDY|Name|A Body test
BDY|Name|A Body test2
MSG|To file|A Message
DOC|HDR|File|A Header test
BDY|Name|A Body test
BDY|Name|A Body test2
MSG|To file|A MessageNote: The DOC record contains all records from HDR to MSG.
Thanks for your helping.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.