[xsd-users] dealing with xml written/read on-the-fly

Cerion Armour-Brown cerion at kestrel.ws
Sat Oct 10 07:14:41 EDT 2009


Hi all,

I've been reading up on XSD - nice toolset!
I'm very interested in using this - I believe this would make 
maintaining the changing xml schemas of my projects a simpler job

I'm looking at porting Valkyrie, a frontend for Valgrind, to Qt4. 
Valgrind is a program analysis framework for and outputs xml on the fly 
to either log files or file-descriptors.

I'm proposing to use C++/Tree as my memory model, but I don't see a 
simple way to parse (and display) the incoming xml chunks as they become 
available.

Qt has xml reader functions parse() and parseContinue(), which one can 
use to read an xml file being written on the fly: one polls the file for 
updates, and calls parseContinue() whenever there's something new to be 
read. The reader keeps track of it's file position, so it's a very 
simple interface.  (But, of course, Qt only provides the standard 
SAX/DOM parsers/models).
=> I'd like to know if there's a simple way of achieving the same thing 
using XSD?
I imagine there would be, as there is talk of supporting RSS etc., but I 
can't work out how, or find examples.
Would I have to use C++/Parser to build the Tree as complete events are 
read in? From my experiments, this looks plausible, but Parser still 
wants to read in the whole xml file in one go... I think I'd have to 
write a fair amount of code to set this up.

I see in the mail archive an interesting reference (subject: CityGML 
1.0.0 and C++/Parser interface) to the use of a custom SAX parser to 
read in chunk by chunk. Is this a good way to go? If so, there is 
mention of example code in the thread - is that available?

Or perhaps I'd be better off going with an iostream (subject: Streaming, 
May 17 2007) ?
If so, again, might there be example code available?
(though for debugging it's always good to have Valgrind's direct XML 
output to analyse when things go wrong - then I'd have to tee the input 
stream or something... hmm).

All advice, pointers, code examples!, etc would be very welcome!

Many thanks,
Cerion




More information about the xsd-users mailing list