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 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 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! > ____________________________________ > P. S. V. P. U. > http://www.pobox.sk/ > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to > >> unsubscribe << >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<