Closed ndw closed 3 weeks ago
In private correspondence, Achim points out that we could greatly simplify things by requiring the source
to be XML or HTML. That leaves out how to handle the (small minority of) cases where constructing an internal subset is necessary. But, as Achim also points out, you could get around that with by constructing the text document and then passing it to p:cast-content-type
.
I like it.
I'm going to update the validation step with this solution and see what folks think.
If you pass an XML or HTML document to
p:validate-with-dtd
withassert-valid=false
, then the input document can simply be returned if validation fails. But what do you do if the input is text?Off-hand, I can think of three options:
Favorites? Other options?
I think I'm inclined to add a new error for this case and go with option 2. If you passed in a text document that you expected to be able to parse with a validating parser and validation fails, I have a hunch that it's going to be unlikely that it's well-formed XML. I'm guessing that the thing you got wrong was a broken declaration or something else that's just not going to parse.
If you really do need to handle the case where you constructed a text document that might be valid XML and might only be well-formed, you can handle it yourself, it's just going to be extra work.