HighTechTalks DotNet Forums  

Need help converting a multi entity flat file into XML

Dotnet XML microsoft.public.dotnet.xml


Discuss Need help converting a multi entity flat file into XML in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Shikari Shambu
 
Posts: n/a

Default Need help converting a multi entity flat file into XML - 07-01-2009 , 04:04 PM






I have a legacy system that outputs a billing file where each data element
has a specific length. The billing file has multiple information

1. Customer billing information
2. Customer shipping information
3. Order information (#, date, totals etc...)
4. Order line items (item#, qty, unit price, line total)

Up until item 3 - it is fixed length. Since an order can have one or more
line items the overall length of the record will vary. The order line itself
will be fixed size that may repeat itself

I need help in figuring out how to transform this into XML. I have come
across examples of flat file to xml conversions where the entire record is
fixed length.

Any help or pointers to a solution is appreciated. Please note I do not have
BizTalk or similar products

Thanks

Reply With Quote
  #2  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Need help converting a multi entity flat file into XML - 07-02-2009 , 06:43 AM






Shikari Shambu wrote:
Quote:
I have a legacy system that outputs a billing file where each data
element has a specific length. The billing file has multiple information

1. Customer billing information
2. Customer shipping information
3. Order information (#, date, totals etc...)
4. Order line items (item#, qty, unit price, line total)

Up until item 3 - it is fixed length. Since an order can have one or
more line items the overall length of the record will vary. The order
line itself will be fixed size that may repeat itself

I need help in figuring out how to transform this into XML. I have come
across examples of flat file to xml conversions where the entire record
is fixed length.
With the .NET framework using regular expression matching might help to
identify items in that flat file. To create XML you can use XmlWriter or
XmlDocument or (in .NET 3.5) LINQ to XML.


--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/

Reply With Quote
  #3  
Old   
Shikari Shambu
 
Posts: n/a

Default Re: Need help converting a multi entity flat file into XML - 07-02-2009 , 08:53 AM



Martin,
Thanks for the input. I guess I forgot to mention that the attributes
are position based I.e. first 20 chars= customer first name 21st= middle
initial 22-42= last name etc... I am not sure if RegEx can help here. If you
have examples I would look to take a look.

Thanks

"Martin Honnen" <mahotrash (AT) yahoo (DOT) de> wrote

Quote:
Shikari Shambu wrote:
I have a legacy system that outputs a billing file where each data
element has a specific length. The billing file has multiple information

1. Customer billing information
2. Customer shipping information
3. Order information (#, date, totals etc...)
4. Order line items (item#, qty, unit price, line total)

Up until item 3 - it is fixed length. Since an order can have one or more
line items the overall length of the record will vary. The order line
itself will be fixed size that may repeat itself

I need help in figuring out how to transform this into XML. I have come
across examples of flat file to xml conversions where the entire record
is fixed length.

With the .NET framework using regular expression matching might help to
identify items in that flat file. To create XML you can use XmlWriter or
XmlDocument or (in .NET 3.5) LINQ to XML.


--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/

Reply With Quote
  #4  
Old   
Martin Honnen
 
Posts: n/a

Default Re: Need help converting a multi entity flat file into XML - 07-02-2009 , 09:10 AM



Shikari Shambu wrote:

Quote:
Thanks for the input. I guess I forgot to mention that the attributes
are position based I.e. first 20 chars= customer first name 21st= middle
initial 22-42= last name etc... I am not sure if RegEx can help here. If
you have examples I would look to take a look.
Regex pattern = @"^(?<fname>.{20})(?<mname>.)(?<lname>.{20})$";
is a regular expression capturing the first twenty characters in a group
named fname, then one character in a group named mname, then twenty
characters in a group named lname. So that way you can easily extract
the portions of the input string.
See http://msdn.microsoft.com/en-us/library/30wbz966.aspx or your local
MSDN library installation on how to use the .NET regular expression classes.


--

Martin Honnen --- MVP XML
http://msmvps.com/blogs/martin_honnen/

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.