Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
encoding/xml: support for xml:lang attribute #14358
xml:lang is a standard attribute defined by the XML specification. Using it is complicated by the fact that an element inherits the nearest xml:lang declaration on itself or an ancestor. For example:
The element bar has an effective xml:lang value of "en-GB".
At the moment, an application wanting access to this information would need to consume an XML document token by token, and maintain its own stack of xml:lang attributes (or include an xml:lang attribute on all parent structs being unmarshalled, and process those). It would be nice if Decoder maintained this stack itself, and exposed it to structs being unmarshaled so that you could easily get the current effective xml:lang attribute.
There is code to do the above here: