[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: Persistence of KParts plugins
From:       Antonio Larrosa =?iso-8859-15?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2003-07-16 23:27:19
[Download RAW message or body]

> > Any idea of what's going wrong?
> >
> 
> Your DOM tree keeps refcounts on KHTML's stuff, which can't destroy
> itself properly. 

I see.

> I'd suggest a deep copy of the DOM tree then (cloneNode(true)).

This is quite strange, but when using the operator = to make a "copy" it 
works well, but when using cloneNode (either with true or false parameter) 
then the web archiver seems to parse an empty document, so it does nothing 
and finish inmediately.

The actual code is:

if(part->document().ownerDocument().isNull())
  // my test page goes in this case
    m_document=part->document().cloneNode(true);
  else
    m_document=part->document().ownerDocument().cloneNode(true);
...
const DOM::Element element = (const DOM::Element) m_document;

// element.isNull() is true

const QString& nodeValue(m_document.nodeValue().string());

// and nodeValue is an empty string

Just removing the .cloneNode(true) makes it work (except by the crash when 
removing the KHTMLFactory )

But the problem seems to me that comes later from:

  try
  {
    // We might throw a DOM exception
    child = m_document.firstChild();
  }
  catch (...)
  {
    child = DOM::Node();
  }

as I've seen that firstChild() really throws an exception and so child is 
nullified and we cannot parse the actual document.
 
Any idea? Thanks a lot for your help so far.

Greetings,

--
Antonio Larrosa Jimenez
KDE developer - larrosa@kde.org
http://developer.kde.org/~larrosa/
The clash of ideas is the sound of freedom.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic