Erroneous parsing of XML content
See original GitHub issueHello,
I’ve noticed that when processing certain XML content, the parser malfunctions. That’s the snippet of the XML document that I am processing:
والجدير بالذكر أن الدورات النقابية المتعاقبة منذ عام 1950م وحتى 2011م بلغت خمسة عشر دورة تتفاوت في آجالها من عام لعامين ولأربعة أعوام ثم خمسة أعوام اعتباراً من دورة 1996_2001 م حسب نصوص القوانين وتطوراته </doc> <doc id="1432834" url="https://ar.wikipedia.org/wiki?curid=1432834" title="ريتا حايك">
However, after parsing the file (either with doc = Jsoup.parse(File f) or doc = Jsoup.parseBodyFragment(String s)), when printing the element’s content (doc.html()), I notice that one doc closing tag turns to a comment closing:
والجدير بالذكر أن الدورات النقابية المتعاقبة منذ عام 1950م وحتى 2011م بلغت خمسة عشر دورة تتفاوت في آجالها من عام لعامين ولأربعة أعوام ثم خمسة أعوام اعتباراً من دورة 1996_2001 م حسب نصوص القوانين وتطوراته </doc--> <doc id="1432834" url="https://ar.wikipedia.org/wiki?curid=1432834" title="ريتا حايك">
Because of that all the remaining content (over 50MB) is loaded as one doc. Does anything come to your mind? Am I doing something wrong or should this be considered a bug?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)

Top Related StackOverflow Question
Hi!
The following file is produced by https://github.com/attardi/wikiextractor applied on the arabic wikipedia dump: jsoup-problem.txt
I guess there is no BOM, I couldn’t find any other unusual tag neither.
(Closing out as we’ve had no other related reports which I would expect if there is an endemic issue - expect this was root-caused by a document flipping around the text order.)