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
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/
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" wrote in message news:O3d7cpw#JHA.1336@TK2MSFTNGP05.phx.gbl... > 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/
Shikari Shambu wrote: > 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/