Skip to content

encoding/xml: does not parse internal subset of DTD as required by standard #68388

Open
@DemiMarie

Description

@DemiMarie

Go version

1.22 I believe

Output of go env in your module/workspace:

Whatever is on https://go.dev/play

What did you do?

Parse XML files with ill-formed or misplaced directives, such as:

  1.  <!BOGUS><a/>
  2. <!DOCTYPE JUNK A><a/>
  3. <a/><!DOCTYPE a>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions