Skip to content

encoding/xml: mismatching namespace error misses a space char #49635

@quasilyte

Description

@quasilyte

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

1.17

Does this issue reproduce with the latest release?

Reproducible on the tip.

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

linux/amd64.

What did you do?

go run example.go (https://play.golang.org/p/dU4NQ2vTVyF):

package main

import (
	"fmt"
	"encoding/xml"
	"strings"
)

func main() {
	const input = `<a:foo></b:foo>`
	d := xml.NewDecoder(strings.NewReader(input))
	d.Token() // read StartElement
	_, err := d.Token() // read EndElement
	fmt.Println(err)
}

What did you expect to see?

XML syntax error on line 1: element <foo> in space a closed by </foo> in space b

What did you see instead?

XML syntax error on line 1: element <foo> in space aclosed by </foo> in space b

Note the diff:

- XML syntax error on line 1: element <foo> in space aclosed by </foo> in space b
+ XML syntax error on line 1: element <foo> in space a closed by </foo> in space b

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions