File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 111111
112112import string , sys , re
113113
114- class _SimpleElementPath :
115- # emulate pre-1.2 find/findtext/findall behaviour
116- def find (self , element , tag ):
117- for elem in element :
118- if elem .tag == tag :
119- return elem
120- return None
121- def findtext (self , element , tag , default = None ):
122- for elem in element :
123- if elem .tag == tag :
124- return elem .text or ""
125- return default
126- def findall (self , element , tag ):
127- if tag [:3 ] == ".//" :
128- return element .getiterator (tag [3 :])
129- result = []
130- for elem in element :
131- if elem .tag == tag :
132- result .append (elem )
133- return result
134-
135- try :
136- from . import ElementPath
137- except ImportError :
138- # FIXME: issue warning in this case?
139- # TODO: DEFINITELY issue warning here!!!
140- ElementPath = _SimpleElementPath ()
114+ from . import ElementPath
141115
142116# TODO: add support for custom namespace resolvers/default namespaces
143117# TODO: add improved support for incremental parsing
You can’t perform that action at this time.
0 commit comments