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

Class XmlToken

recipes/Python/578138_gprof2dotpy/recipe-578138.py:662–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

660
661
662class XmlToken:
663
664 def __init__(self, type, name_or_data, attrs = None, line = None, column = None):
665 assert type in (XML_ELEMENT_START, XML_ELEMENT_END, XML_CHARACTER_DATA, XML_EOF)
666 self.type = type
667 self.name_or_data = name_or_data
668 self.attrs = attrs
669 self.line = line
670 self.column = column
671
672 def __str__(self):
673 if self.type == XML_ELEMENT_START:
674 return '<' + self.name_or_data + ' ...>'
675 if self.type == XML_ELEMENT_END:
676 return '</' + self.name_or_data + '>'
677 if self.type == XML_CHARACTER_DATA:
678 return self.name_or_data
679 if self.type == XML_EOF:
680 return 'end of file'
681 assert 0
682
683
684class XmlTokenizer:

Callers 6

handle_element_startMethod · 0.85
handle_element_endMethod · 0.85
finish_character_dataMethod · 0.85
__next__Method · 0.85
element_startMethod · 0.85
element_endMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected