My file is something like that

<a>x</a>
<b>y</b>

There is no root tags, and I cant modify this file. I would like to be
able to parse it without loading it entirely in memory (buffer) or
without make a copy of this file to add the root tags...

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: August 24, 2005 4:09 PM
To: Struts Users Mailing List
Subject: [OT] Re: xmlparser simple question

Gilbert,

SAX works on an event based model. Memory is not an issue unless *you*
are caching information as you receive events in your parser handler.

The parser starts reading the stream. Each time it encounters the
beginning of an element or an attribute, or the value of an element or
attribute, or the end of an element or attribute, it simply fires an
event. Your parser handler receives the event. At that point, the parser
forgets that part of the stream and moves on to the next part. At any
one time, the most it's going to cache is a single element or attribute
name or value.

I'm not sure though what you mean by "add the root in the parsing
processing". Perhaps you could explain further.

Erik


-----Original Message-----
From: "Gilbert, Antoine" <[EMAIL PROTECTED]>
Sent: Aug 24, 2005 3:59 PM
To: Struts Users Mailing List <user@struts.apache.org>
Subject: xmlparser simple question

Hi

 

I want to read an xml file using a SAXReader combined with a
ParserHandler. The file have n o XML root, so I have to find how to add
it in the parsing processing. Assuming that the file can be pretty big,
how I can do it without at any time having the entire file in memory ?

 

 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to