Solved

Filestream C#

Posted on 2012-03-14
1
316 Views
Last Modified: 2012-03-29
Hi Experts,

Please give me some suggesstion for below,

I have batch process for which I will get  a txt file as a input which will have 150k byte length or lesser. The txt file will have a header line like "date, time etc...." as one line.
and remaining will  as xml tags.
Before the xml tag starts, I will have 20 byte string like "A0000001-0000001-1-4" which is
Auto Number + unique seq# + split xml seq # + total split xmls.
If the txt file is 150k then the input txt fiel is splitting the string to 5.
so in between xml i  will be having
A0000001-0000001-1-5
A0000001-0000001-2-5
A0000001-0000001-3-5
A0000001-0000001-4-5
A0000001-0000001-5-5

This is used to spllit the string in the iput file to 5 parts for some reason.
I am using File stream,  to open the file and do my operations.

Now, i want to read the file and find out for

A0000001-0000001-1-4
A0000001-0000001-2-4
A0000001-0000001-3-4
A0000001-0000001-4-4

and remove it so that i will get the proper xml.

and in the same way as output from my batch i will get the same kind of xml string.

I need to find out the size and if it is > 30k, i need to split the xml string using (need to insert the below split string in between the xml string and send).
A0000001-0000001-1-4
A0000001-0000001-2-4
A0000001-0000001-3-4
A0000001-0000001-4-4


Below, is the sample xml string,

F0008243-0000001-1-5<AutoPolicy><PolicyNumber>F0008243-0000001-1-5</PolicyNumber><TransactionCode>52</TransactionCode><PolicyType> </PolicyType><Process>RENEWALS</Process><State>NJ
F0008243-0000001-2-5</State><Company>NJM</Company><RateIndicator>3</RateIndicator><PolicyEffectiveDate>02/25/2012</PolicyEffectiveDate><RateEffectiveDateRenewingFrom>3
F0008243-0000001-3-5</RateEffectiveDateRenewingFrom

Please tell me the best way to do it.

Basically while reading input file I need to remove the split string (F0008243-0000001-1-5) and stror in DB.

After processing i need to insert the split string into xml string and send.

Please suggesst me the best approach.

Thanks
0
Comment
Question by:RameshLathu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 22

Accepted Solution

by:
ambience earned 500 total points
ID: 37724040
Hmm .. how about reading all in a string and then using a regular expression for the 20-byte string to split the input. This would work as long as the autonumber string is not supposed to occur inside XML.

OR to be more robust you could write a simple parser which reads a autonumber first and then it keeps reading XML till the ending tag and then switches the state and read a number again. This should be simple considering the XML has balanced < and > characters and once you encounter a starting < you read till and ending >.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question