- From: Kang Jeong-Hee <Keizi@mail.co.kr>
- Date: Sat, 14 Jun 2003 00:02:25 +0900
- To: www-dom@w3.org
There's only three kind of way to get Element from DOM:
1. create it newly.
2. get it by id.
3. get it via NodeList.
but NodeList return Node, not Element.
$ grep Element *.idl | grep -v interface | grep -v attribute
css.idl: typedef dom::Element Element;
css.idl: CSSStyleDeclaration getComputedStyle(in Element elt,
css.idl: CSSStyleDeclaration getOverrideStyle(in Element elt,
dom.idl: NodeList getElementsByTagName(in DOMString name);
dom.idl: NodeList getElementsByTagNameNS(in DOMString namespaceURI,
dom.idl: Element createElement(in DOMString tagName)
dom.idl: NodeList getElementsByTagName(in DOMString tagname);
dom.idl: Element createElementNS(in DOMString namespaceURI,
dom.idl: NodeList getElementsByTagNameNS(in DOMString namespaceURI,
dom.idl: Element getElementById(in DOMString elementId);
html2.idl: typedef dom::Element Element;
html2.idl: NodeList getElementsByName(in DOMString elementName);
html2.idl: void add(in HTMLElement element,
html2.idl: in HTMLElement before)
html2.idl: HTMLElement createTHead();
html2.idl: HTMLElement createTFoot();
html2.idl: HTMLElement createCaption();
html2.idl: HTMLElement insertRow(in long index)
html2.idl: HTMLElement insertRow(in long index)
html2.idl: HTMLElement insertCell(in long index)
I'm implementing DOM Level 2, here: http://gybe.sf.net/dominigue/
and having trouble on testing Element::getElementsByTagName();
I do load a html file into document, and reach to 'body'
via NodeList::item(0) from HTMLDocument::getElementsByName('body').
And now I do Element::getElementsByTagName('table')
to get elements under 'body' with the name of 'table'.
This makes trouble:
(process:4322): GLib-GObject-WARNING **: invalid cast from `domNode' to `domElement'
NodeList::item(0) return the 'body' Node, not Element.
And there's no guaranty that the Node returned is Element.
(Or I could be wrong. Let me know if I'm wrong.)
How can I break though this trouble?
Don't hesitate on implementation-specific.
You can tell me anything about basis of OOP.
Thanks in advance,
Kang Jeong-Hee.
Received on Friday, 13 June 2003 10:59:33 UTC