kopia lustrzana https://github.com/micropython/micropython-lib
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
rodzic
79f13b6e4a
commit
fdf984d07d
|
@ -9,5 +9,6 @@
|
||||||
baz
|
baz
|
||||||
|
|
||||||
</u:GetConnectionTypeInfo>
|
</u:GetConnectionTypeInfo>
|
||||||
|
<!-- Comments, you won't see me after tokenize. -->
|
||||||
</s:Body>
|
</s:Body>
|
||||||
</s:Envelope>
|
</s:Envelope>
|
||||||
|
|
|
@ -95,6 +95,14 @@ class XMLTokenizer:
|
||||||
yield from self.lex_attrs_till()
|
yield from self.lex_attrs_till()
|
||||||
self.expect("?")
|
self.expect("?")
|
||||||
self.expect(">")
|
self.expect(">")
|
||||||
|
elif self.match("!"):
|
||||||
|
self.expect("-")
|
||||||
|
self.expect("-")
|
||||||
|
last3 = ''
|
||||||
|
while True:
|
||||||
|
last3 = last3[-2:] + self.getch()
|
||||||
|
if last3 == "-->":
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
tag = self.getnsident()
|
tag = self.getnsident()
|
||||||
yield (START_TAG, tag)
|
yield (START_TAG, tag)
|
||||||
|
|
Ładowanie…
Reference in New Issue