[XML-SIG] Re: [4suite] Extend of cDomlette DOM API support
Uche Ogbuji
uche.ogbuji@fourthought.com
22 Jul 2002 00:39:05 -0600
On Wed, 2002-06-12 at 21:37, L. C. Rees wrote:
> Is there documentation of which DOM methods are implemented in the current version of cDomlette (I'm using 0.4.11 with Python 2.2) and which methods may be added in the future?
>
> One convienient method, getElementsByTagName, isn't present. Are there plans to do this sometime in the near future? Is there a substitute?
I don't remember if anyone ever responded to this. Sorry if not. On
Python 2.2:
def doc_order_iterator(node):
yield node
for child in node.childNodes:
for cn in doc_order_iterator(child):
yield cn
return
def doc_order_iterator_filter(node, filter_func):
if filter_func(node):
yield node
for child in node.childNodes:
for cn in doc_order_iterator_filter(child, filter_func):
if filter_func(cn):
yield cn
return
def get_elements_by_tag_name_ns(node, ns, local):
return doc_order_iterator_filter(node, lambda n: n.nodeType ==
Node.ELEMENT_NODE and n.namespaceURI == ns and n.localName == local)
--
Uche Ogbuji Fourthought, Inc.
http://uche.ogbuji.net http://4Suite.org http://fourthought.com
Track chair, XML/Web Services One Boston: http://www.xmlconference.com/
The many heads of XML modeling - http://adtmag.com/article.asp?id=6393
Will XML live up to its promise? -
http://www-106.ibm.com/developerworks/xml/library/x-think11.html