xmltok: Skip comment markup in XML.

This is provisional solution, at later time, comments may become tokenized
and fed to the caller, like other syntactic elements.
pull/183/merge
ThunderEX 2017-05-24 21:08:30 +08:00 zatwierdzone przez Paul Sokolovsky
rodzic 79f13b6e4a
commit fdf984d07d
2 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -9,5 +9,6 @@
baz
</u:GetConnectionTypeInfo>
<!-- Comments, you won't see me after tokenize. -->
</s:Body>
</s:Envelope>

Wyświetl plik

@ -95,6 +95,14 @@ class XMLTokenizer:
yield from self.lex_attrs_till()
self.expect("?")
self.expect(">")
elif self.match("!"):
self.expect("-")
self.expect("-")
last3 = ''
while True:
last3 = last3[-2:] + self.getch()
if last3 == "-->":
break
else:
tag = self.getnsident()
yield (START_TAG, tag)