-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behavior of XDocumentType/XmlDocumentType.InternalSubset parsing is inconsistent to manual creation #44866
Comments
Tagging subscribers to this area: @buyaa-n, @krwq, @jeffhandley Issue Details
|
We should fix this in 6.0 timeline. If we do not plan to make product change we should update the docs to reflect reality. |
As can be seen below when manually passing null to the constructor/CreateDocumentType as internal subset it prints nothing when serializing and reports null in the property but when parsing it prints extra when serialized
[]
(empty internal subset) and doesn't serialize to the same as input and property reports string.Empty.See following example:
and similar for XmlDocument
For XmlDocument the docs mention that "The DTD internal subset on the DOCTYPE. If there is no DTD internal subset, String.Empty is returned.". But that does not seem to be true as seen in the first example.
Good thing they're at least consistent between each other.
Additionally recently suggested by the docs telling that XmlDocument.InternalSubset doesn't return null I changed XDocumentType to treat null and string.Empty the same (if passed null you would get same output as for the second example rather than null). I plan to revert this change as part of fix for #44489 - we can re-think the behavior in this issue.
My suggestion is to do one of the following (first and last option would fix consistency):
<!DOCTYPE foo[]>
when serializing and return string.Empty - assuming users do not care about having extra[]
in the doctype (cosmetic difference as they have no semantic meaning) this would make it slightly easier to use and at least be consistent between parsing and manually passing subsetcc: @buyaa-n @jozkee @stephentoub
The text was updated successfully, but these errors were encountered: