Skip to content

encoding/xml: Encoder duplicates namespace tags #7535

Open
@gopherbot

Description

@gopherbot

by seanerussell:

== What does 'go version' print?

go version go1.2.1 darwin/amd64

== What steps reproduce the problem?

http://play.golang.org/p/3_oUruPYhq

== What happened?

Encoder.EncodeToken duplicates namespace attributes.

== What should have happened instead?

The encoded document should have had a single namespace attribute.

== Please provide any additional information below.

Attribute names on an element must be unique; this is a well-formedness constraint per
the XML 1.0 specification (http://www.w3.org/TR/xml/#uniqattspec). Per the
specification, both validating and non-validating parsers must report well-formedness
violations (http://www.w3.org/TR/xml/#sec-conformance).

Encoding and decoding XML documents should be idempotent and produce equivalent
documents.  This issue means that not only that decoding and encoding the result
produces a non-equivalent document, but that the document it generates is
not-well-formed.

This issue only occurs with namespaces.  Normal attributes are handled correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.early-in-cycleA change that should be done early in the 3 month dev cycle.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions