p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

biztalk thread: Importing flat files that contain field names


Message #1 by "Shaun Dodimead" <shaun@s...> on Fri, 8 Feb 2002 16:48:12
Hi,



 I've got a flat file with one record that looks like 



 NAME: Bob

 AGE: 20

 HEIGHT: 6ft



 that I want to translate into



 <Record>

  <Name>Bob</Name>

  <Age>20</Age>

  <Height>6ft</Height>

 </Record>



 I've been through all the flat file stuff I could find in the 

Editor/Mapper tools, but I'm not sure I can do this with them?.



Is it possible using the standard biztalk tools and I've missed something, 

or will I have to write a custom parser/preprocessor?



thanks



Shaun.



 



 
Message #2 by "Donaldson, John (GEO)" <John.M.Donaldson@c...> on Mon, 11 Feb 2002 17:44:43 +0100
Shaun,



it looks as though you can do that. What sort of errors

are you getting?



I just hacked together a schema with three records (is this

your problem?), each separated by carriage returns, and

within each record (Name, Age, Height) different source tag

identifiers (e.g. NAME:), and with field separator of space.



It compiles and maps, but I haven't actually run a doc

through it.



John.



-----Original Message-----

From: Shaun Dodimead [mailto:shaun@s...]

Sent: 08 February 2002 17:48

To: Biztalk

Subject: [biztalk] Importing flat files that contain field names





Hi,



 I've got a flat file with one record that looks like



 NAME: Bob

 AGE: 20

 HEIGHT: 6ft



 that I want to translate into



 <Record>

  <Name>Bob</Name>

  <Age>20</Age>

  <Height>6ft</Height>

 </Record>



 I've been through all the flat file stuff I could find in the

Editor/Mapper tools, but I'm not sure I can do this with them?.



Is it possible using the standard biztalk tools and I've missed 

something,

or will I have to write a custom parser/preprocessor?



thanks



Shaun.












Message #3 by "Shaun Dodimead" <shaun@s...> on Tue, 12 Feb 2002 10:14:52
> Shaun,

> 

> it looks as though you can do that. What sort of errors

> are you getting?

> 

> I just hacked together a schema with three records (is this

> your problem?), each separated by carriage returns, and

> within each record (Name, Age, Height) different source tag

> identifiers (e.g. NAME:), and with field separator of space.

> 

> It compiles and maps, but I haven't actually run a doc

> through it.

> 

> John.

> 

> -----Original Message-----

> From: Shaun Dodimead [mailto:shaun@s...]

> Sent: 08 February 2002 17:48

> To: Biztalk

> Subject: [biztalk] Importing flat files that contain field names

> 

> 

> Hi,

> 

>  I've got a flat file with one record that looks like

> 

>  NAME: Bob

>  AGE: 20

>  HEIGHT: 6ft

> 

>  that I want to translate into

> 

>  <Record>

>   <Name>Bob</Name>

>   <Age>20</Age>

>   <Height>6ft</Height>

>  </Record>

> 

>  I've been through all the flat file stuff I could find in the

> Editor/Mapper tools, but I'm not sure I can do this with them?.

> 

> Is it possible using the standard biztalk tools and I've missed 

> something,

> or will I have to write a custom parser/preprocessor?

> 

> thanks

> 

> Shaun.

> 

> 

> 

> 




Message #4 by "Shaun Dodimead" <shaun@s...> on Tue, 12 Feb 2002 10:21:09
John,



Thanks for the response, (sorry about the last post, random forum!)

 

> it looks as though you can do that. What sort of errors

> are you getting?



I keep having trouble with it either saying additional data at end (root 

node as postfix), or cannot find trailing 0x000d (infix)

 

> I just hacked together a schema with three records (is this

> your problem?), each separated by carriage returns, and

> within each record (Name, Age, Height) different source tag

> identifiers (e.g. NAME:), and with field separator of space.



That is my problem, i'm getting confused with what the record/field 

seperators are for the root and subnodes. Sorry to be stupid, could you 

tell me exactly what the delimiters should be? I've got



Root             <- Delim CR (postfix)

!--Name          <- ST "Name:" (no quotes) Delim SPACE

!--Age           <- ST "Age:" Delim SPACE

!--Size          <- ST "Size:" Delim SPACE



parsing

-------------

NAME: Shaun

AGE: 400

SIZE: 70

<CR>

-------------

While parsing record "Root", the parser cannot find the required trailing 

delimiter: "<CR>" (0x000d).



> It compiles and maps, but I haven't actually run a doc

> through it.



Could you send me the map?

 

Shaun
Message #5 by "Donaldson, John (GEO)" <John.M.Donaldson@c...> on Wed, 13 Feb 2002 10:47:22 +0100
Shaun,



since I haven't actually tested my map, I'll hang on

to it until I've run a doc through it.



But, now you've actually described your error, I'm

pretty sure it's just a question of getting the combination

of "skip CR"/"skip LF"/infix/postfix correct.



For example, in the case where you are finding

extra data at the end, you should put skip=3Dyes.



If this doesn't get you going, I'll really test

mine and let you have the result.



John.



-----Original Message-----

From: Shaun Dodimead [mailto:shaun@s...]

Sent: 12 February 2002 11:21

To: Biztalk

Subject: [biztalk] RE: Importing flat files that contain field names





John,



Thanks for the response, (sorry about the last post, random forum!)



> it looks as though you can do that. What sort of errors

> are you getting?=3D20



I keep having trouble with it either saying additional data at end (root 



node as postfix), or cannot find trailing 0x000d (infix)



> I just hacked together a schema with three records (is this

> your problem?), each separated by carriage returns, and=3D20

> within each record (Name, Age, Height) different source tag

> identifiers (e.g. NAME:), and with field separator of space.



That is my problem, i'm getting confused with what the record/field

seperators are for the root and subnodes. Sorry to be stupid, could you

tell me exactly what the delimiters should be? I've got



Root             <- Delim CR (postfix)

!--Name          <- ST "Name:" (no quotes) Delim SPACE

!--Age           <- ST "Age:" Delim SPACE

!--Size          <- ST "Size:" Delim SPACE



parsing

-------------

NAME: Shaun

AGE: 400

SIZE: 70

<CR>

-------------

While parsing record "Root", the parser cannot find the required 

trailing

delimiter: "<CR>" (0x000d).



> It compiles and maps, but I haven't actually run a doc

> through it.



Could you send me the map?



Shaun




Message #6 by "Shaun Dodimead" <shaun@s...> on Wed, 13 Feb 2002 10:25:20
John



> since I haven't actually tested my map, I'll hang on

> to it until I've run a doc through it.



cool

 

> But, now you've actually described your error, I'm

> pretty sure it's just a question of getting the combination

> of "skip CR"/"skip LF"/infix/postfix correct.



Yea I think so, it's just burning my head a little!

 

> For example, in the case where you are finding

> extra data at the end, you should put skip=3Dyes.



Problem is it's extra data is coming from the Root node, which is already 

set to skip no (cos that fields are split by CR's effectively)



> If this doesn't get you going, I'll really test

> mine and let you have the result.



Thanks, i'd really appreciate it. Its a wonder there is a FAQ out there, 

because i've read loads of messages about the same sort of problem!.



Shaun
Message #7 by "Donaldson, John (GEO)" <John.M.Donaldson@c...> on Wed, 13 Feb 2002 16:05:51 +0100

Shaun,



I'm sending you the schema of the following flat-file instance:



S65,1

D1999-09-09

LLaurence Lebihan,12 rue des Bouchers,Marseille



As you can see, where you have things like "AGE: ", I have single

letters such as "D", but it should work just as well.



The list server won't let me attach so here below is the schema.



I was sending you a map and an output spec, but I don't

think you need it - your error is in the input spec.

Anyway, that document passes through a channel and maps

to an output spec. (Believe me!)



By the way, I can't get the escape character to work,

so if you have that working, I'm interested.



John D.



------------------------------------------



  <?xml version=3D"1.0" ?>

- <!--  Generated by using BizTalk Editor on Wed, Feb 13 2002 03:28:12 

PM

  -->

- <!--  Microsoft Corporation (c) 2000 (http://www.microsoft.com)

  -->

- <Schema name=3D"TentRequest" b:BizTalkServerEditorTool_Version=3D"1.0" 

b:root_reference=3D"TentRequest" b:def_record_delim=3D"0xd" 

b:def_field_delim=3D"0x2c" b:def_escape_char=3D"0x3f" 

b:standard=3D"FlatFile" xmlns=3D"urn:schemas-microsoft-com:xml-data" 

xmlns:b=3D"urn:schemas-microsoft-com:BizTalkServer" 

xmlns:d=3D"urn:schemas-microsoft-com:datatypes">

  <b:SelectionFields />

- <ElementType name=3D"TentSpec" content=3D"empty" model=3D"closed">

  <b:RecordInfo tag_name=3D"S" structure=3D"delimited" 

delimiter_type=3D"hex" delimiter_value=3D"0x2c" field_order=3D"infix" 

skip_CR=3D"no" skip_LF=3D"yes" />

- <AttributeType name=3D"People" d:type=3D"int">

  <b:FieldInfo />

  </AttributeType>

- <AttributeType name=3D"Lights" d:type=3D"boolean">

  <b:FieldInfo />

  </AttributeType>

  <attribute type=3D"People" required=3D"no" />

  <attribute type=3D"Lights" required=3D"no" />

  </ElementType>

- <ElementType name=3D"TentRequest" content=3D"eltOnly" 

model=3D"closed">

  <description>A Comma Separated Variable file spec.</description>

  <b:RecordInfo structure=3D"delimited" delimiter_type=3D"hex" 

delimiter_value=3D"0xd" field_order=3D"infix" 

escape_type=3D"inherit_escape" append_newline=3D"yes" skip_CR=3D"no" 

skip_LF=3D"yes" />

  <element type=3D"TentSpec" maxOccurs=3D"1" minOccurs=3D"1" />

  <element type=3D"DeliveryDate" maxOccurs=3D"1" minOccurs=3D"1" />

  <element type=3D"DeliveryLocation" maxOccurs=3D"1" minOccurs=3D"1" />

  </ElementType>

- <ElementType name=3D"DeliveryLocation" content=3D"empty" 

model=3D"closed">

  <b:RecordInfo tag_name=3D"L" structure=3D"delimited" 

delimiter_type=3D"hex" delimiter_value=3D"0x2c" field_order=3D"infix" 

skip_CR=3D"no" skip_LF=3D"yes" />

- <AttributeType name=3D"Street" d:type=3D"string" d:maxLength=3D"100" 

d:minLength=3D"1">

  <b:FieldInfo />

  </AttributeType>

- <AttributeType name=3D"DeliverTo" d:type=3D"string" d:maxLength=3D"50" 

d:minLength=3D"1">

  <description>Customer name</description>

  <b:FieldInfo />

  </AttributeType>

- <AttributeType name=3D"City" d:type=3D"string" d:maxLength=3D"100" 

d:minLength=3D"1">

  <b:FieldInfo />

  </AttributeType>

  <attribute type=3D"DeliverTo" required=3D"no" />

  <attribute type=3D"Street" required=3D"no" />

  <attribute type=3D"City" required=3D"no" />

  </ElementType>

- <ElementType name=3D"DeliveryDate" content=3D"empty" model=3D"closed">

  <b:RecordInfo tag_name=3D"D" structure=3D"delimited" 

delimiter_type=3D"hex" delimiter_value=3D"0x2c" field_order=3D"infix" 

skip_CR=3D"no" skip_LF=3D"yes" />

- <AttributeType name=3D"HireDate" d:type=3D"date">

  <b:FieldInfo />

  </AttributeType>

  <attribute type=3D"HireDate" required=3D"no" />

  </ElementType>

  </Schema>


  Return to Index