Changeset 2746:b6bc186f21ca in livinglogic.python.xist

Show
Ignore:
Timestamp:
07/03/07 13:59:57 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

hasname() and hasname_xml() now only test elements, procinsts and entities
(comments etc. have no .xmlname anyway).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/ll/xist/xfind.py

    r2743 r2746  
    108108    def match(self, path): 
    109109        if path: 
    110             return path[-1].__class__.__name__ == self.name 
     110            node = path[-1] 
     111            return isinstance(node, (xsc.Element, xsc.ProcInst, xsc.Entity)) and node.__class__.__name__ == self.name 
    111112        return False 
    112113 
     
    121122    def match(self, path): 
    122123        if path: 
    123             return path[-1].xmlname == self.name 
     124            node = path[-1] 
     125            return isinstance(node, (xsc.Element, xsc.ProcInst, xsc.Entity)) and node.xmlname == self.name 
    124126        return False 
    125127