[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: [kde-devel] DOM classes advanced usage help request
From: Juraj Novak <juraj_novak () pobox ! sk>
Date: 2002-06-07 21:49:58
[Download RAW message or body]
> On Friday 07 June 2002 01:47, Juraj Novak wrote:
> > Greetings everyone!
> >
> > I am using KHTMLPart as a DOM tree build
> > mechanism, it works very ok. But I have 2
> > questions:
> >
> > 1. How to make parsing of a XML document
> > synchronous, not to have needs for connecting to
> > completed() signal?
>
> By using QT's DOM (QDom classes), if you do not
need CSS.
>
> (see QDomDocument::setContent)
>
> >
> > 2. How to know offset of an DOM element(node) in
> > a parsed source file? Say when I ask DOM classes
> > for all <img> tags, I would like to know their
> > possitions from the begining of a file. Is it
> > possible at least for some nodes, e.g.
> > attributes? Or is it completely imposible and
> > one must use regular expressions for this? But
> > regular expressions don't build DOM trees,
> > that's the point :|
>
> You cannot. DOM is not defined for doing this.
>
> However, what do you want to do with your <IMG>
elements. Change them? If yes,
> try to use QDomDocument::elementsByTagName. (I
suppose that KHTML has this
> function too, as it is a DOM function.)
>
> If your problem is to save back the file to disk,
then you should really use
> QDom (for example QDomDocument::toString or
QDomDocument::save . These are
> *not* DOM functions.)
>
> >
> > TAI
>
> Have a nice day/evening/night!
>
Thank you very much for your answer. Yes I want to
modify tags from a source file, e.g. I want to
modify tag img and tag frame to something else. I
will have a close look on functions you've notice
and be glad if they would be helpfull.
I was thinking maybe of some hack to handle this
with KDE library, say hanging myself on a data()
signal from some KIO::job while writing it on disk,
searching that buffer for occurence of some
tag...hmmm but how to synchronize.
Have a nice day too, cya
____________________________________
http://www.pobox.sk/ - spolahliva a bezpecna prevadzka
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic