diff --git a/lib/pure/htmlparser.nim b/lib/pure/htmlparser.nim
index c941708031..e1a0096f6e 100644
--- a/lib/pure/htmlparser.nim
+++ b/lib/pure/htmlparser.nim
@@ -544,6 +544,8 @@ proc parseHtml*(s: PStream, filename: string,
# force progress!
next(x)
close(x)
+ if result.len == 1:
+ result = result[0]
proc parseHtml*(s: PStream): PXmlNode =
## parses the XTML from stream `s` and returns a ``PXmlNode``. All parsing
diff --git a/lib/pure/xmlparser.nim b/lib/pure/xmlparser.nim
index 8c5c5f5ab5..355053e0dc 100644
--- a/lib/pure/xmlparser.nim
+++ b/lib/pure/xmlparser.nim
@@ -110,11 +110,9 @@ proc parseXml*(s: PStream, filename: string,
of xmlElementOpen, xmlElementStart:
result = parse(x, errors)
break
- of xmlComment, xmlWhitespace: nil # just skip it
+ of xmlComment, xmlWhitespace, xmlSpecial: nil # just skip it
of xmlError:
errors.add(errorMsg(x))
- of xmlSpecial:
- errors.add(errorMsg(x, " expected"))
else:
errors.add(errorMsg(x, " expected"))
break