W3C home > Mailing lists > Public > www-validator@w3.org > November 2010

Re: validation of undefined prefixes

From: Benjamin Hawkes-Lewis <bhawkeslewis@googlemail.com>
Date: Wed, 17 Nov 2010 14:30:12 +0000
Message-ID: <AANLkTinju3OQJW8MrimL=bBsmN_vLTXs2neeDL9Ch1VF@mail.gmail.com>
To: Waclaw Kusnierczyk <waku@idi.ntnu.no>
Cc: www-validator@w3.org
On Tue, Nov 16, 2010 at 7:53 PM, Waclaw Kusnierczyk <waku@idi.ntnu.no> wrote:
> I note that the following trivial code:
>
> <?xml version="1.1"?>
> <foo:bar xmlns:foo="" />
>
> successfully validates in your online validator.  However, the W3C XML 1.1
> specification version 2 states
>
> "The namespace prefix, unless it is xml or xmlns, must have been declared in
> a namespace declaration attribute in either the start-tag of the element
> where the prefix is used or in an ancestor element (i.e. an element in whose
> content the prefixed markup occurs). Furthermore, the attribute value in the
> innermost such declaration must not be an empty string."
>
> and the above code seems to violate this requirement.  In the tag foo:bar,
> the prefix foo is explicitly undefined, and then used to refer to a
> namespace.
>
> Could you please comment on this?

You are quoting from the "Namespaces in XML 1.1 (Second Edition)" spec
not the "Extensible Markup Language (XML) 1.1 (Second Edition)" spec:

http://www.w3.org/TR/xml-names11/

http://www.w3.org/TR/xml11/

The validator says:

"The uploaded document was successfully checked as well-formed XML.
This means that we were not able to determine the exact document type,
but that the document passed the XML well-formedness syntax check. If
you wish to wish to perform formal validation of the document, you can
use the 'Document Type:' option of the validator."

A document does not need to meet the constraints of the "Namespaces in
XML" spec in order to be well-formed XML according to the "Extensible
Markup Language" spec:

http://www.w3.org/TR/xml11/#sec-well-formed

Indeed, the only mention of namespaces in the "Extensible Markup
Language" spec is this:

"The Namespaces in XML Recommendation [XML Names] assigns a meaning to
names containing colon characters. Therefore, authors should not use
the colon in XML names except for namespace purposes, but XML
processors must accept the colon as a name character."

http://www.w3.org/TR/xml11/#sec-common-syn

Hope that helps.

--
Benjamin Hawkes-Lewis
Received on Wednesday, 17 November 2010 14:32:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:44 GMT