Skip to content

encoding/xml: decoding XML with entities not supported #35389

Open
@yaoh3i

Description

@yaoh3i

What version of Go are you using (go version)?

$ go version
go version go1.13.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
darwin/amd64

What did you do?

I parsed the XML with the entity, but the part with the entity was not parsed (the entity value is in the DTD).
I checked the documentation and set xml.Decoder.Strict to false. What appears is the entity itself, not the value of the entity.

This is my program:
https://play.golang.org/p/pxIrus-iW8b

What did you expect to see?

127.0.0.1
hello

What did you see instead?

When d.Strict = true, there is nothing.
When d.Strict = false, output:

127.0.0.1
&n;

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions