Re: Incinsistency with XML-starting Namespace prefixes - Processing expectations.
Chris Pratt <[email protected]> Thu, 13 Mar 2014 10:49:51 -0700
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <CAALdY0zVJd-xjWx47HhjsCc-RR26JzrOWTEnfd3Wj3-AJ5M7EA@mail.gmail.com> |
--===============0118384282== Content-Type: multipart/alternative; boundary=14dae9399b133a8fd904f480966e --14dae9399b133a8fd904f480966e Content-Type: text/plain; charset=ISO-8859-1 Maybe just logging a warning would be sufficient. (*Chris*) On Thu, Mar 13, 2014 at 6:09 AM, Michael Kay <[email protected]> wrote: > > 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 > > The basic issue is the following: The input XML document contains: > > <XMLFault:XMLFault>...</XMLFault:XMLFault> > > And the namespace XMLFault is declared somewhere.... > > According to the XML specification, the namespace prefix is not allowed to > start with the letters XML (in any case, upper, or lower). > > JDOM is not allowing this to happen, and failing to process/load the > document. > > Unfortunately, the specification actually says: > > *Namespace constraint: Reserved Prefixes and Namespace Names* > > 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. > > 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. > > All other prefixes beginning with the three-letter sequence x, m, l, in > any case combination, are reserved. This means that: > > - > > users *SHOULD NOT* use them except as defined by later specifications > - > > processors *MUST NOT* treat them as fatal errors. > > > JDOM is a processor, and it's treating this as a fatal error. > > How should this be fixed? Suggestions? > > 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? > > Rolf > > > > _______________________________________________ > To control your jdom-interest membership: > http://www.jdom.org/mailman/options/jdom-interest/[email protected] > > > > _______________________________________________ > To control your jdom-interest membership: > http://www.jdom.org/mailman/options/jdom-interest/[email protected] > --14dae9399b133a8fd904f480966e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Maybe just logging =A0a warning would be sufficient.<div>= =A0 (*Chris*)</div></div><div class=3D"gmail_extra"><br><br><div class=3D"g= mail_quote">On Thu, Mar 13, 2014 at 6:09 AM, Michael Kay <span dir=3D"ltr">= <<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]= m</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div style=3D"word-wrap:break-word"><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 f= or use by W3C in current or future standards". Therefore a W3C standar= d could come out next week that defines a legitimate use of the name "= XMLFault". You would want JDOM applications to work with such document= s.</div> <div><br></div><div>Pragmatically, such names are in common use by users wh= o 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><div class=3D"h5"><div>On 13 Mar 2014, at 12:51, Rolf <<a href= =3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>> wrote:</d= iv> <br></div></div><blockquote type=3D"cite"><div><div class=3D"h5"> =20 =20 =20 <div bgcolor=3D"#FFFFFF" text=3D"#000000"> An issue has been opened against JDOM: <a href=3D"https://github.com/hunterhacker/jdom/issues/126" target=3D"_= blank">https://github.com/hunterhacker/jdom/issues/126</a><br> <br> The basic issue is the following: The input XML document contains:<br> <br> =A0=A0=A0=A0 <span><XMLFault:XMLFault></span>...<span></XMLFau= lt:XMLFault><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><p><a name=3D"144bb9be5893277f_xmlReserved"><b>Namespace constraint: Reserved Prefixes and Namespace Names</b></a></p> <a name=3D"144bb9be5893277f_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 title=3D"MAY in RFC 2119 context">MAY</em>, but need not, be declared, and <em title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> be bound to any other namespace name. Other prefixes <em title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> be bound to this namespace name, and it <em 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 title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> be declared . Other prefixes <em title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> be bound to this namespace name, and it <em title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> be declared as the default namespace. Element names <em 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 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 title=3D"MUST NOT in RFC 2119 context">MUST NOT</em> treat them as fatal errors.</p> </li> </ul> </a></div> </blockquote> <span><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></div></div> _______________________________________________<br>To control your jdom-int= erest membership:<br><a href=3D"http://www.jdom.org/mailman/options/jdom-in= terest/[email protected]" target=3D"_blank">http://www.jdom.org/mailman= /options/jdom-interest/[email protected]</a></blockquote> </div><br></div><br>_______________________________________________<br> To control your jdom-interest membership:<br> <a href=3D"http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourh= ost.com" target=3D"_blank">http://www.jdom.org/mailman/options/jdom-interes= t/[email protected]</a><br></blockquote></div><br></div> --14dae9399b133a8fd904f480966e-- --===============0118384282== 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] --===============0118384282==--