You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@dcsobral said:
Speaking only of Xhtml, we have the following rules:
It must be an XML Document
It must conform to one of certain pre-defined DTDs.
The root element of the document must be html.
The root element of the document must contain an xmlns declaration.
There must be a DOCTYPE declaration in the document prior to the root element.
The DTD subset must not be used to override any parameter entities in the DTD
From the pre-requisite of it needing to be an XML Document, we have this requirement, indicating that it must follow the production rule prolog element Misc*, where prolog and Misc contain only the xml declaration, comments, processing instructions, spaces and newlines.
So, taken all together, XhtmlParser should complain about the following:
There's more than one root.
It does not conform to any of the valid DTDs.
The root is not called html.
The root does not contain a xmlns declaration.
There's no DOCTYPE declaration prior to the root.
I expect such strictness to be detrimental instead of a feature for most applications. However, failing and still returning something -- that does not represent the input given -- is definitely very bad.
For whatever it is worth, this reminds me a lot of #4520. Though the symptom is rather different, I suspect they both arise from the lack of an exception.
=== What steps will reproduce the problem (please be specific and use wikiformatting)? ===
=== What is the expected behavior? ===
Expected it to throw an exception saying "document must contain exactly one element"
=== What do you see instead? ===
Repl output:
:1:8: document must contain exactly one element ^
, )List(
res1: scala.xml.NodeSeq = Document()
(Its printing an error to the console???)
=== Additional information ===
(for instance, a link to a relevant mailing list discussion)
=== What versions of the following are you using? ===
The text was updated successfully, but these errors were encountered: