Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Schema

Status
Not open for further replies.

StrathClyde

Programmer
Jul 16, 2007
1
0
0
CA
Hi, another newbie here.
I'm having problems creating a schema for a positional/delimited text file.

Here is a sample:


"1....."
"2....."
"3....."
"4....."
"5....."
"8....."

The structure of this file is as follows:

a) Each line is 130 characters with 0x0D 0x0A at end
b) Each line is wrapped in "
c) Field 1 is the RecordTypeID and always 1 character
d) The remaining data is 127 characters and does not need to be further broken down (just a field named Data)
e) Each data file will have one record of RecordType 1 (the header)
f) Each data file will have one record of RecordType 8 (the footer)
g) Each data file will have at least one other type of record, could be many, could be 1. not important, read on.

The goal is to append thousands of these files together, of course using different logic... WITH the exception that the resulting file will have ONLY 1 Header record and 1 Footer record. In other words, append the inner data of thousands of files together.

I know my first step is to build a schema in BizTalk 2006 to actually read in a file. This I can fine using the schema of

...
- <xs:annotation>
- <xs:appinfo>
<schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension=" />
<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="FixedFormat" />
</xs:appinfo>
</xs:annotation>
- <xs:element name="FixedFormat">
- <xs:annotation>
- <xs:appinfo>
<b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" 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=" />
</xs:appinfo>
</xs:annotation>
- <xs:element maxOccurs="unbounded" name="Items">
- <xs:annotation>
- <xs:appinfo>
<b:recordInfo tag_name=""" structure="delimited" child_delimiter_type="char" child_delimiter=""" child_order="postfix" 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=" />
</xs:appinfo>
</xs:annotation>
- <xs:element name="Item">
- <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=" />
</xs:appinfo>
</xs:annotation>
- <xs:element name="RecordTypeID" type="xs:int">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="1" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:element>
- <xs:element name="Data" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo justification="left" pos_offset="0" pos_length="127" sequence_number="2" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


I would like to have a schema that separates the header, inner items and footer, if possible.

Maybe I'm going about this the wrong way. Don't know.

Any help would be appreciated.

Thanks.
 


You can use a custom pipeline and the Flat File Disassembler component where messages are parsed using header, trailer, and body schemas.

Use the Flat File Schema Wizard to create schemas.

Stew


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top