Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xerces advanced usage - progresss, random access etc

From: "Kza" <kzawah@-----.--->
To: NULL
Date: 9/8/2006 12:25:00 PM

Just as an update here, and I hope top posting is de riguer for this
news group,

I solved feature one with xerces getSrcOffset() method. Even though I
had to wrap it with an exception catcher, as the particular version we
are using at work at the moment causes an exception when parsing is
finished (but before the parse method returns) and theres no other way
to find out when its finished.

Feature 2 I dont have a solution for at the moment. DOM is not an
option as the whole point is that a whole file uses up too much memory,
and DOM loads the whole thing at once, thats why we wanted to load in a
section at a time.

If it turns out really important to analyse large files, I will just
have to write a seperate program that uses sax, and maybe only filters
for certain things, or perhaps reparses when people want to "scroll up"
which has its own time trade off for saving memory. Its up to the
customers really. I suspect the real solution is a non-xml indexed
binary format. But the memory issue isnt actually as big as the
customers think it is.. I will work something out.

Boris Kolpackov wrote:
> "Kza" <kzawah@g...> writes:
>
> > Feature 1: A progress display. I have tried a few times now to find a
> > way of asking xerces how far through a file it is in bytes, but no
> > luck. (I did try a per element check, but that involves a whole extra
> > parse at the start just to count the elements). I have tried using the
> > LocalFileInputSource, and getting its BinInputStream and calling itc
> > curPos, but its always 0.
> >
> > Any ideas?
>
> You can implement your own InputStream which will keep track of how
> much data Xerces-C++ has consumed so far. Combine this with the total
> length of the file and you can calculate the progress.
>
>
> > Feature 2: Loading only a "screenful" of the file at a time. I also
> > would like some sort of random access functionality, so if the user
> > scrolls down to 75% of the file, the parser skips forward to that
> > position and starts reading there, and when they scroll back up it goes
> > up and reads just that little bit of the file.
>
> This one would definitely be easier with an in-memory model (e.g., DOM).
>
>
> hth,
> -boris
>
>
> --
> Boris Kolpackov
> Code Synthesis Tools CC
> http://www.codesynthesis.com
> Open-Source, Cross-Platform C++ XML Data Binding



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent