Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Filestream C#

Posted on 2012-03-14
1
Medium Priority
?
319 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 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

604 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