fixes #1518
This commit is contained in:
parent
db6b2bf1c7
commit
50d593787f
2 changed files with 20 additions and 15 deletions
|
|
@ -636,12 +636,14 @@ proc rawGetTok(my: var XmlParser) =
|
||||||
|
|
||||||
proc getTok(my: var XmlParser) =
|
proc getTok(my: var XmlParser) =
|
||||||
while true:
|
while true:
|
||||||
|
let lastKind = my.kind
|
||||||
rawGetTok(my)
|
rawGetTok(my)
|
||||||
case my.kind
|
case my.kind
|
||||||
of xmlComment:
|
of xmlComment:
|
||||||
if my.options.contains(reportComments): break
|
if my.options.contains(reportComments): break
|
||||||
of xmlWhitespace:
|
of xmlWhitespace:
|
||||||
if my.options.contains(reportWhitespace): break
|
if my.options.contains(reportWhitespace) or lastKind in {xmlCharData, xmlComment, xmlEntity}:
|
||||||
|
break
|
||||||
else: break
|
else: break
|
||||||
|
|
||||||
proc next*(my: var XmlParser) =
|
proc next*(my: var XmlParser) =
|
||||||
|
|
|
||||||
|
|
@ -164,3 +164,6 @@ when isMainModule:
|
||||||
var xml = loadXml(filePath, errors)
|
var xml = loadXml(filePath, errors)
|
||||||
assert(errors.len == 0, "The file tests/testdata/doc1.xml should be parsed without errors.")
|
assert(errors.len == 0, "The file tests/testdata/doc1.xml should be parsed without errors.")
|
||||||
|
|
||||||
|
block bug1518:
|
||||||
|
var err: seq[string] = @[]
|
||||||
|
assert $parsexml(newStringStream"<tag>One & two</tag>", "temp.xml", err) == "<tag>One & two</tag>"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue