New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/xml: empty namespace prefix definitions should be illegal #8068

Open
ghost opened this Issue May 21, 2014 · 7 comments

Comments

Projects
None yet
7 participants
@ghost
Copy link

ghost commented May 21, 2014

What does 'go version' print?
go version go1.2 linux/amd64


What steps reproduce the problem?
http://play.golang.org/p/f8UWfdF7Hb

What happened?
No-error.

What should have happened instead?
Should generate an error.

Per http://www.w3.org/TR/REC-xml-names/#dt-prefix a prefix must refer to a namespace
name, not the empty string. 

Please provide any additional information below.

Ran into this in implementing webdav, the litmus tests test this error condition [and
due to xml.Token hiding prefixing it is impossible to detect otherwise]
@griesemer

This comment has been minimized.

Copy link
Contributor

griesemer commented Oct 1, 2014

Comment 1:

Labels changed: added repo-main, release-none.

@rogpeppe

This comment has been minimized.

Copy link
Contributor

rogpeppe commented Nov 27, 2014

Comment 2:

> Per http://www.w3.org/TR/REC-xml-names/#dt-prefix a prefix must
> refer to a namespace name, not the empty string. 
I couldn't find this stated clearly in the spec. It says "The attribute's normalized
value MUST be either a URI reference — the namespace name identifying the namespace
— or an empty string.". It also explicitly allows the empty string for the xmlns
attribute itself (from section 6.2: "The attribute value in a default namespace
declaration MAY be empty. This has the same effect, within the scope of the declaration,
of there being no default namespace.")
That said, it's not clear what the semantics should be for an empty value.
@ghost

This comment has been minimized.

Copy link
Author

ghost commented Nov 27, 2014

Comment 3:

I must admit I was echo'ing the complaint from the WebDAV litmus test suite; which
claimed an empty prefix specification was invalid. 
I agree with your reading that it doesn't appear clear. 6.3. doesn't apply here, i'm
concerned specifically with namespace prefixes [the test in WebDAV is with xmlns:dav=""]

@ghost ghost added new labels Nov 27, 2014

@bradfitz bradfitz removed the new label Dec 18, 2014

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc removed release-none labels Apr 10, 2015

@nigeltao

This comment has been minimized.

Copy link
Contributor

nigeltao commented May 21, 2015

It could be that, at the time of writing of the WebDAV litmus test suite, an empty namespace prefix was illegal, but that has since become legal. The grammar differs between
http://www.w3.org/TR/2006/REC-xml-names-20060816/#ns-decl and
http://www.w3.org/TR/REC-xml-names/#dt-prefix

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 8, 2018

Change https://golang.org/cl/105636 mentions this issue: encoding/xml: fix invalid empty namespace without prefix

@iWdGo

This comment has been minimized.

Copy link
Contributor

iWdGo commented Apr 8, 2018

Namespace handling is not checking this case before adding the namespace to the namespace array of the decoder. A related fix is submitted which also rejects syntax xmlns:="..." which is invalid.

@gopherbot

This comment has been minimized.

Copy link

gopherbot commented Apr 27, 2018

Change https://golang.org/cl/109855 mentions this issue: encoding/xml : Fixes to enforce XML namespace standard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment