XML Probs (Off Topic)

Richard Moore rich at ipso-facto.freeserve.co.uk
Tue Sep 12 00:12:53 BST 2000



Martin Piskernig wrote:
> 
> On Wed, 12 Jul 2000 ian reinhart geiser wrote:
> >       I am trying to build an RDF parser for KDE2
> >       using qxml.h.
> >       Needless to say to docs are poor at best.
> >       Has anyone played with this?  Can anyone
> >       point me to some sample code?  Or am I on
> >       my own.
> 
> You shouldn't use QXml directly. Instead use QDom.

This is not always the best way to handle things. Often
the DOM structure is a waste of time, as you use an
application oriented structure to store the same information.
Fortunately recent versions of QDOM include support for the
SAX API (Simple API for XML) which allows you to use your own
data structure while still abstracting away from the details
of the parser. For a simple format like RDF this may well be
the best approach.

I'd suggest having a word with the Trolls (I can't remember
if it is Reggie or Torben who is writing this stuff). I have
written code that uses QXML directly, but the SAX API is a
better solution. If you *must* use QXML then note that the
bool flag returned by your parse methods indicates success,
(ie. the parser will stop if it is false) this confused me
for a while.

Rich.



> Build a QDomDocument and read/write QDomElement's.
> Good examples for this are in the koffice package (e.g.
> I found kspread a very good guide in using qdom).
> --
> Martin Piskernig
> <mpiskernig at kdevelop.org>      ICQ: 24015591
> The KDevelop Team           www.kdevelop.org
> Volksbefragung: Hingehen und ungültig stimmen!




More information about the KDevelop mailing list