MCPcopy Create free account
hub / github.com/ActiveState/code / startElement

Method startElement

recipes/Python/298721_xml2obj_II/recipe-298721.py:178–196  ·  view source on GitHub ↗

SAX start element even handler

( self, name, oAttributes )

Source from the content-addressed store, hash-verified

176
177
178 def startElement( self, name, oAttributes ):
179 'SAX start element even handler'
180 global fDebug
181
182 if fDebug:
183 print "startElement(",name.encode(),")"
184 attr={ }
185 for oKey in oAttributes.getNames( ):
186 oData = oAttributes.getValue( oKey )
187 if string.strip( oKey ):
188 key = oKey.encode( )
189 data = oData.strip( )
190 attr[key] = data.encode( )
191 parent = self.listDataStack[ -1 ]
192 node = xmlElement( name.encode(), parent, attr )
193 if parent is not None:
194 parent.addChild( node )
195 self.listDataStack.append( node )
196 self.data = ''
197
198
199 def characters( self, data ):

Callers

nothing calls this directly

Calls 6

xmlElementClass · 0.85
encodeMethod · 0.45
getValueMethod · 0.45
stripMethod · 0.45
addChildMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected