[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: port of pyjamas to pykde / khtml - issues and observations with
From: Richard Dale <rdale () foton ! es>
Date: 2008-10-14 10:59:38
Message-ID: 200810141159.38837.rdale () foton ! es
[Download RAW message or body]
On Monday 13 October 2008 21:43:17 Luke Kenneth Casson Leighton wrote:
> > also, crucially - absolutely, absolutely crucially: you can't do a
> > "compare" against nodes. the objects are potentially different. and
>
> folks, hi,
>
> this is a show-stopper, and needs to be fixed. i tried creating a
> workaround wrapper class, by extending pykhtml's dom.py, with a view
> to making it the "central" location - choke-point - through which the
> creation of all Node and Node-derived objects go, but there doesn't
> exist a function in the underlying DOM model to uniquely identify the
> c++ objects. not the wrappers _around_ the c++ objects, the c++
> objects themselves.
The best place for this sort of thing is to post to the kde-bindings@kde.org
list, and talk with Simon Edwards the PyKDE maintainer.
However, you are right in this case that the problem is that there isn't
sufficient RTTI information in the C++ api to identify what class an instance
is. Here is a snippet of code from the Ruby bindings that attempts to identify
DOM::Node classes. But there are many other classes which can't be identified.
} else if (strcmp(smoke->classes[classId].className, "DOM::Node") == 0) {
DOM::Node * node = (DOM::Node *) smoke->cast(ptr, classId, smoke-
>idClass("DOM::Node"));
switch (node->nodeType()) {
case DOM::Node::ELEMENT_NODE:
if (((DOM::Element*)node)->isHTMLElement()) {
return "DOM::HTMLElement";
} else {
return "DOM::Element";
}
case DOM::Node::ATTRIBUTE_NODE:
return "DOM::Attr";
case DOM::Node::TEXT_NODE:
return "DOM::Text";
case DOM::Node::CDATA_SECTION_NODE:
return "DOM::CDATASection";
case DOM::Node::ENTITY_REFERENCE_NODE:
return "DOM::EntityReference";
case DOM::Node::ENTITY_NODE:
return "DOM::Entity";
case DOM::Node::PROCESSING_INSTRUCTION_NODE:
return "DOM::ProcessingInstruction";
case DOM::Node::COMMENT_NODE:
return "DOM::Comment";
case DOM::Node::DOCUMENT_NODE:
return "DOM::Document";
case DOM::Node::DOCUMENT_TYPE_NODE:
return "DOM::DocumentType";
case DOM::Node::DOCUMENT_FRAGMENT_NODE:
return "DOM::DocumentFragment";
case DOM::Node::NOTATION_NODE:
return "DOM::Notation";
}
}
Maybe the code has changed since I looked at it and KDE3, I haven't had a
really careful look at it for a while. The KHTML guys might be able to help
best.
-- Richard
>> 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