Re: Incinsistency with XML-starting Namespace prefixes - Processing expectations.

Michael Kay <[email protected]> Thu, 13 Mar 2014 13:09:36 +0000
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
--===============1839606450==
Content-Type: multipart/alternative; boundary="Apple-Mail=_EFAA484E-1B82-4FD7-8DCE-4E4FC72380E0"


--Apple-Mail=_EFAA484E-1B82-4FD7-8DCE-4E4FC72380E0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=iso-8859-1


JDOM (and other processors) should allow such names. It shouldn't be a =
configuration option.

"Reserved" means (I believe) "reserved for use by W3C in current or =
future standards". Therefore a W3C standard could come out next week =
that defines a legitimate use of the name "XMLFault". You would want =
JDOM applications to work with such documents.

Pragmatically, such names are in common use by users who haven't read =
the admonition against them, and since most software in the processing =
chain allows them, it's awkward for everyone if the data then hits a =
processor that doesn't.

Michael Kay
Saxonica


On 13 Mar 2014, at 12:51, Rolf <[email protected]> wrote:

> An issue has been opened against JDOM: =
https://github.com/hunterhacker/jdom/issues/126
>=20
> The basic issue is the following: The input XML document contains:
>=20
>      <XMLFault:XMLFault>...</XMLFault:XMLFault>
>=20
> And the namespace XMLFault is declared somewhere....
>=20
> According to the XML specification, the namespace prefix is not =
allowed to start with the letters XML (in any case, upper, or lower).
>=20
> JDOM is not allowing this to happen, and failing to process/load the =
document.
>=20
> Unfortunately, the specification actually says:
>=20
> Namespace constraint: Reserved Prefixes and Namespace Names
>=20
> The prefix xml is by definition bound to the namespace name =
http://www.w3.org/XML/1998/namespace. It MAY, but need not, be declared, =
and MUST NOT be bound to any other namespace name. Other prefixes MUST =
NOT be bound to this namespace name, and it MUST NOT be declared as the =
default namespace.
>=20
> The prefix xmlns is used only to declare namespace bindings and is by =
definition bound to the namespace name http://www.w3.org/2000/xmlns/. It =
MUST NOT be declared . Other prefixes MUST NOT be bound to this =
namespace name, and it MUST NOT be declared as the default namespace. =
Element names MUST NOT have the prefix xmlns.
>=20
> All other prefixes beginning with the three-letter sequence x, m, l, =
in any case combination, are reserved. This means that:
>=20
> users SHOULD NOT use them except as defined by later specifications
>=20
> processors MUST NOT treat them as fatal errors.
>=20
>=20
> JDOM is a processor, and it's treating this as a fatal error.
>=20
> How should this be fixed? Suggestions?
>=20
> As far as I can tell the only place needed to change the code is in =
the Verifier, but, should it simply allow the prefixes, or should it be =
a 'configurable' setting?
>=20
> Rolf
>=20
>=20
>=20
> _______________________________________________
> To control your jdom-interest membership:
> =
http://www.jdom.org/mailman/options/jdom-interest/[email protected]


--Apple-Mail=_EFAA484E-1B82-4FD7-8DCE-4E4FC72380E0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=iso-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html =
charset=3Diso-8859-1"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: =
after-white-space;"><div><br></div><div>JDOM (and other processors) =
should allow such names. It shouldn't be a configuration =
option.</div><div><br></div><div>"Reserved" means (I believe) "reserved =
for use by W3C in current or future standards". Therefore a W3C standard =
could come out next week that defines a legitimate use of the name =
"XMLFault". You would want JDOM applications to work with such =
documents.</div><div><br></div><div>Pragmatically, such names are in =
common use by users who haven't read the admonition against them, and =
since most software in the processing chain allows them, it's awkward =
for everyone if the data then hits a processor that =
doesn't.</div><div><br></div><div>Michael =
Kay</div><div>Saxonica</div><div><br></div><br><div><div>On 13 Mar 2014, =
at 12:51, Rolf &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; =
wrote:</div><br class=3D"Apple-interchange-newline"><blockquote =
type=3D"cite">
 =20

    <meta http-equiv=3D"content-type" content=3D"text/html; =
charset=3DISO-8859-1">
 =20
  <div bgcolor=3D"#FFFFFF" text=3D"#000000">
    An issue has been opened against JDOM:
    <a class=3D"moz-txt-link-freetext" =
href=3D"https://github.com/hunterhacker/jdom/issues/126">https://github.co=
m/hunterhacker/jdom/issues/126</a><br>
    <br>
    The basic issue is the following: The input XML document =
contains:<br>
    <br>
    &nbsp;&nbsp;&nbsp;&nbsp; <span =
class=3D"nt">&lt;XMLFault:XMLFault&gt;</span>...<span =
class=3D"nt">&lt;/XMLFault:XMLFault&gt;<br>
      <br>
      And the namespace XMLFault is declared somewhere....<br>
      <br>
      According to the XML specification, the namespace prefix is not
      allowed to start with the letters XML (in any case, upper, or
      lower).<br>
      <br>
      JDOM is not allowing this to happen, and failing to process/load
      the document.<br>
      <br>
      Unfortunately, the specification actually says:<br>
      <br>
    </span>
    <blockquote>
      <div class=3D"constraint"><p class=3D"prefix"><a id=3D"xmlReserved" =
name=3D"xmlReserved"><b>Namespace
              constraint: Reserved Prefixes and Namespace =
Names</b></a></p>
        <a id=3D"xmlReserved" name=3D"xmlReserved"><p>
            The prefix <b>xml</b> is by definition bound to the
            namespace name
            <code>http://www.w3.org/XML/1998/namespace</code>. It
            <em class=3D"RFC2119" title=3D"MAY in RFC 2119 =
context">MAY</em>,
            but need not, be
            declared, and <em class=3D"RFC2119" title=3D"MUST NOT in RFC
              2119 context">MUST NOT</em>
            be
            bound to any other namespace name. Other prefixes
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            be bound to this namespace
            name,
            and it
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            be declared as the default namespace.
          </p><p>
            The prefix <b>xmlns</b> is used only to declare namespace
            bindings and is by
            definition bound to the namespace name
            <code>http://www.w3.org/2000/xmlns/</code>. It
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            be declared
            .
            Other prefixes
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            be bound to this namespace name,
            and it
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            be declared as the default namespace.
            Element names
            <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
              NOT</em>
            have the prefix <code>xmlns</code>.
          </p><p>
            All other prefixes beginning with the three-letter sequence
            x, m, l,
            in any case combination, are reserved. This means that:
          </p>
          <ul>
            <li><p>users <em class=3D"RFC2119" title=3D"SHOULD NOT in =
RFC
                  2119 context">SHOULD NOT</em> use them except as
                defined by later specifications</p>
            </li>
            <li><p>processors
                <em class=3D"RFC2119" title=3D"MUST NOT in RFC 2119 =
context">MUST
                  NOT</em>
                treat them as fatal errors.</p>
            </li>
          </ul>
        </a></div>
    </blockquote>
    <span class=3D"nt"><br>
      JDOM is a processor, and it's treating this as a fatal error.<br>
      <br>
      How should this be fixed? Suggestions?<br>
      <br>
      As far as I can tell the only place needed to change the code is
      in the Verifier, but, should it simply allow the prefixes, or
      should it be a 'configurable' setting?<br>
      <br>
      Rolf<br>
      <br>
      <br>
      <br>
    </span>
  </div>

_______________________________________________<br>To control your =
jdom-interest membership:<br><a =
href=3D"http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhos=
t.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost=
.com</a></blockquote></div><br></body></html>=

--Apple-Mail=_EFAA484E-1B82-4FD7-8DCE-4E4FC72380E0--

--===============1839606450==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
--===============1839606450==--