Documents are wrongly accepted, in violation of the XML spec.
What did you expect to see?
Either encoding/xml performs the checks on directives that non-validating parsers must perform, or all directives (including DTDs) are rejected by default. The latter is what .NET’s XML parser does: by default, DTDs are a fatal parse error.
Go version
1.22 I believe
Output of
go env
in your module/workspace:What did you do?
Parse XML files with ill-formed or misplaced directives, such as:
https://go.dev/play/p/ZzfA0W3EUMJ has an example.
What did you see happen?
Documents are wrongly accepted, in violation of the XML spec.
What did you expect to see?
Either
encoding/xml
performs the checks on directives that non-validating parsers must perform, or all directives (including DTDs) are rejected by default. The latter is what .NET’s XML parser does: by default, DTDs are a fatal parse error.