BizTalk Server Applications Integration - Delimited Flat file problem

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Applications Integration > July 2005 > Delimited Flat file problem





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Delimited Flat file problem
pj

2005-07-08, 5:51 pm

Hi -
Here's my flat file

HR,PURC,1
AR,PURC,11
AR,PURC,12
AR,PURC,13
HR,SALE,2
AR,SALE,21
AR,SALE,22
AR,SALE,23

I have managed to get an XML that looks like this :

<LOOP xmlns="http://SWIFTSchemas.Schema3">
<HR Field1="PURC,1" xmlns="">
<AR Field2="PURC" Field3="11"></AR>
<AR Field2="PURC" Field3="12"></AR>
<AR Field2="PURC" Field3="13"></AR>
</HR>
</LOOP>

<LOOP xmlns="http://SWIFTSchemas.Schema3">
<HR Field1="SALE,2" xmlns="">
<AR Field2="SALE" Field3="21"></AR>
<AR Field2="SALE" Field3="22"></AR>
<AR Field2="SALE" Field3="23"></AR>
</HR>
</LOOP>

By following a post already on this site - but that was for positional files.

Whatever I try I can't get the HR Field1 split into separate fields
i.e. I'd like (in the second message)
<HR Field1="SALE" Field1a="2" xmlns="">

Here's the schema I'm currently using ...Help Please!

<?xml version="1.0" encoding="utf-16" ?>
- <xs:schema xmlns="http://SWIFTSchemas.Schema3"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
targetNamespace="http://SWIFTSchemas.Schema3"
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="LOOP" />
<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="LOOP">
- <xs:annotation>
- <xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
sequence_number="1" child_delimiter_type="hex" child_delimiter="0x0D 0x0A"
child_order="infix" />
</xs:appinfo>
</xs:annotation>
- <xs:complexType>
- <xs:sequence>
- <xs:annotation>
- <xs:appinfo>
<b:groupInfo sequence_number="0" />
</xs:appinfo>
</xs:annotation>
- <xs:element maxOccurs="1" name="HR">
- <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" tag_name="HR," child_order="postfix"
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 maxOccurs="unbounded" name="AR">
- <xs:annotation>
- <xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false"
child_delimiter_type="char" tag_name="AR," child_order="infix"
child_delimiter="," sequence_number="2" />
</xs:appinfo>
</xs:annotation>
- <xs:complexType>
- <xs:attribute name="Field2" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo sequence_number="1" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="Field3" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo sequence_number="2" justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attribute name="Field1" type="xs:string">
- <xs:annotation>
- <xs:appinfo>
<b:fieldInfo justification="left" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Tomas Restrepo \(MVP\)

2005-07-09, 2:47 am

Pj,

> Here's my flat file
>
> HR,PURC,1
> AR,PURC,11
> AR,PURC,12
> AR,PURC,13
> HR,SALE,2
> AR,SALE,21
> AR,SALE,22
> AR,SALE,23
>
> I have managed to get an XML that looks like this :
>

<snip/>

You need to do several changes to make it work. Here's one possible
solution:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://SWIFTSchemas.Schema3"
xmlns:b="http://schemas.microsoft.com/BizTalk/2003"
targetNamespace="http://SWIFTSchemas.Schema3"
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="LOOP" />
<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="LOOP">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="true"
suppress_trailing_delimiters="false" sequence_number="1" child_order="infix"
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="1" maxOccurs="unbounded" name="RECORD">
<xs:annotation>
<xs:appinfo>
<b:recordInfo sequence_number="1" structure="delimited"
preserve_delimiter_for_empty_data="true"
suppress_trailing_delimiters="false" child_order="infix" tag_name="HR"
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="HR">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="true"
suppress_trailing_delimiters="false" child_delimiter_type="char"
child_delimiter="," child_order="prefix" sequence_number="1" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attribute name="Name" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="1"
justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Value" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="2"
justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element minOccurs="1" maxOccurs="unbounded" name="AR">
<xs:annotation>
<xs:appinfo>
<b:recordInfo structure="delimited"
preserve_delimiter_for_empty_data="true"
suppress_trailing_delimiters="false" child_delimiter_type="char"
tag_name="AR" child_order="prefix" child_delimiter="," sequence_number="2"
repeating_delimiter_type="hex" repeating_delimiter="0x0D 0x0A" />
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attribute name="Field2" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="1"
justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
<xs:attribute name="Field3" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo sequence_number="2"
justification="left" />
</xs:appinfo>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>


--
Tomas Restrepo
tomasr@mvps.org
http://www.winterdom.com/


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com