473,505 Members | 13,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to parse a incomplete xml file

11 New Member
I have to write a program where we get the xml file incrementally. i.e the file is constantly updated in the form of xml feed. Thus the first chunk will not be a well formed xml document. However i need to parse the feeds regularly and display the parsed result.

How can this be achieved.?

Eg...

xml field can be following

First chunk is as follows: We can see it is not well formed
<xml>
<results>
<result1>
</result1?
<result2>
</result2>


The next chunk will be

<result3>
</result3>
<result4>
</result4>
</results>
</xml>



Please help!! I would be greatful if you could provide me with sample code or some links which i can follow.

TIA
Jan 13 '09 #1
5 2368
weaknessforcats
9,208 Recognized Expert Moderator Expert
If your XML file is updated while you are processing it, you will have a real problem.

Where does the "constantly updated" occur? Do you have any control over this? Is there a window where you know no updating will occcur so you can fetch the file?
Jan 13 '09 #2
gpraghuram
1,275 Recognized Expert Top Contributor
My suggestion wuld be you have to wait for the whole file to be received and then parse it.
Raghu
Jan 14 '09 #3
praveenss
11 New Member
@weaknessforcats
The file is not updated. At this point i can say that i get every chunk as a char buffer.
So basically there is no file which is got but it is the chunks of data as a char buffer which i get from the server.
The feed is terminated after all chunks have arrived with the closing tag.

So if we put together all the chunks then we get the well formed xml body in a char buffer. If written to a file then we get the well formed xml file. But the objective is to process every chunk and display on the UI
Jan 14 '09 #4
weaknessforcats
9,208 Recognized Expert Moderator Expert
I don't know if processing individual "chunks" is possible. A syntax may be split over different "chunks".

Why can't you write the XML data to disc and start your browser? Certainly you are not attempting to write an XML parser from scratch. Yes? Doing so will will occupy the rest of your lifetime.
Jan 14 '09 #5
jkmyoung
2,057 Recognized Expert Top Contributor
Note, this Question comes from XML forum, but was split out due to the stream question. Although not stated here, the given solution in the other thread leads to another question:

How does one take different inputs, and feed them one at a time through a stream?

This way an event driven parser can look at the stream as the data comes in.
Jan 15 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2578
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID),...
4
2946
by: oliver.lin | last post by:
In my simple test code, I tried to define my constructor outside of the class declaration headr file. The header file: file_handler.h ============================================================...
2
4953
by: Vittal | last post by:
Hello All, I am trying to compile my application on Red Hat Linux 8 against gcc 3.2.2. Very first file in application is failing to compile. I tried compiling my application on Linux 7.2...
2
2806
by: Mauricio Correa | last post by:
Hello, i try to consume a java web service from a asp .net page, i make without problems the web reference tu wsdl file http://machine/WebService/nameWebService?WSDL in the asp .net page put the...
2
1862
by: Jan | last post by:
In a 2-page order form, not all applicants will complete it due to field validations. If I want to see data from incomplete orders, can this be done using some sort of session control so that each...
10
3180
by: Michael B. Trausch | last post by:
Alright... I am attempting to find a way to parse ANSI text from a telnet application. However, I am experiencing a bit of trouble. What I want to do is have all ANSI sequences _removed_ from...
29
2868
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
50
4429
by: Juha Nieminen | last post by:
I asked a long time ago in this group how to make a smart pointer which works with incomplete types. I got this answer (only relevant parts included): ...
11
8317
by: praveenss | last post by:
I have to write a program where we get the xml file incrementally. i.e the file is constantly updated in the form of xml feed. Thus the first chunk will not be a well formed xml document. However i...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.