RE: ParsedXML getElementsByTagName() from docume nt node broken

[email protected] Wed, 28 Aug 2002 17:41:37 -0700
Newsgroups gmane.comp.web.zope.parsed-xml
Message-ID <AA7A72A46469D411B8B300508BE329500543191F@desi2>
I think I understand the problem; I am assuming that the ParsedXML object
should proxy this method to the document element.

I changed line 252 in ParsedXML 1.3's ParsedXML.py:
    def getElementsByTagName(self, tagName):
        return self.__getattr__("getElementsByTagName")(tagName)
To:
    def getElementsByTagName(self, tagName):
        return self.documentElement.getElementsByTagName(tagName)

This suits my needs.  Would there be any reason why this kind of thing
shouldn't be universally enabled?  I'm curious about whether or not this
should be something that is worthy of check-in into ParsedXML CVS - or would
this break something else, or has this been solved another way?

Sean

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Wednesday, August 28, 2002 4:41 PM
To: [email protected]
Subject: [Parsed-XML-Dev] ParsedXML getElementsByTagName() from document
node broken


Hey all... I know this list is terribly quiet, so I hope I'm not shouting
into an empty forest here, but I'm encountering something I think is a bug
with ParsedXML that is particularly frustrating:

The code for ParsedXML.getElementsByTagName() is flat out broken when called
on the ParsedXML object (document node).  

The following doesn't work, because it raises an attribute error for
__getattr__

    # methods that override ZDOM methods that are incorrect
    #

    def getElementsByTagName(self, tagName):
        return self.__getattr__("getElementsByTagName")(tagName)

    def hasChildNodes(self): 
        return self.__getattr__("hasChildNodes")()


I have a bunch of reader components created using PyDOM as a reference
implementation, and most of these components obtain the top-level node in
the document by calling getElementsByTagName().  I would like to try and fix
ParsedXML instead of rewrite (already DOM compliant) code for all the
methods in my reader components, but I'm not sure where to start.

Any pointers?

Sean

+-----------------------------------------------------------
| Sean Upton
|  Site Technology Supervisor             SignOnSanDiego.com
|  Development & Integration     The San Diego Union-Tribune
|  619.718.5241                     [email protected]
|        PATH_TO_THE_DARK_SIDE = 'c:\winnt\system32'
+-----------------------------------------------------------

_______________________________________________
Parsed-XML-Dev mailing list
[email protected]
http://lists.zope.org/mailman/listinfo/parsed-xml-dev