golang/go

encoding/xml: decoding XML with entities not supported

Open

#35,389 opened on Nov 6, 2019

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
ExpertNeededNeedsInvestigationhelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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

Does this issue reproduce with the latest release?

Yes

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

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;

Contributor guide