Skip to content

encoding/xml: accepts XML with no space between attributes #68385

@DemiMarie

Description

@DemiMarie

Go version

1.22.5 (this is from pkg.go.dev)

Output of go env in your module/workspace:

Whatever is on `pkg.go.dev` as of the filing of this issue

What did you do?

https://go.dev/play/p/_xXpPKU-YWQ

package main import "encoding/xml" func main() { err := xml.Unmarshal([]byte(`<a b="c" c="d"/>`), new(interface{})) if err != nil { panic("well-formed XML rejected")	} err = xml.Unmarshal([]byte(`<a b="c"c="d"/>`), new(interface{})) if err == nil { panic("missing space before attribute name accepted")	} }

What did you see happen?

Unmarshaling the XML succeeds, even though there is a missing space between b="c" and c="d".

What did you expect to see?

Unmarshaling <a b="c"c="d"/> fails. libxml2 correctly rejects this.

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