Incinsistency with XML-starting Namespace prefixes - Processing expectations.
Rolf <[email protected]> Thu, 13 Mar 2014 08:51:47 -0400
| Newsgroups | gmane.comp.java.jdom.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
--===============0566996619==
Content-Type: multipart/alternative;
boundary="------------010904050201030102000309"
This is a multi-part message in MIME format.
--------------010904050201030102000309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
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
--------------010904050201030102000309
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
An issue has been opened against JDOM:
<a class="moz-txt-link-freetext" href="https://github.com/hunterhacker/jdom/issues/126">https://github.com/hunterhacker/jdom/issues/126</a><br>
<br>
The basic issue is the following: The input XML document contains:<br>
<br>
<span class="nt"><XMLFault:XMLFault></span>...<span
class="nt"></XMLFault: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 class="constraint">
<p class="prefix"><a id="xmlReserved" name="xmlReserved"><b>Namespace
constraint: Reserved Prefixes and Namespace Names</b></a></p>
<a id="xmlReserved" name="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="RFC2119" title="MAY in RFC 2119 context">MAY</em>,
but need not, be
declared, and <em class="RFC2119" title="MUST NOT in RFC
2119 context">MUST NOT</em>
be
bound to any other namespace name. Other prefixes
<em class="RFC2119" title="MUST NOT in RFC 2119 context">MUST
NOT</em>
be bound to this namespace
name,
and it
<em class="RFC2119" title="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="RFC2119" title="MUST NOT in RFC 2119 context">MUST
NOT</em>
be declared
.
Other prefixes
<em class="RFC2119" title="MUST NOT in RFC 2119 context">MUST
NOT</em>
be bound to this namespace name,
and it
<em class="RFC2119" title="MUST NOT in RFC 2119 context">MUST
NOT</em>
be declared as the default namespace.
Element names
<em class="RFC2119" title="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="RFC2119" title="SHOULD NOT in RFC
2119 context">SHOULD NOT</em> use them except as
defined by later specifications</p>
</li>
<li>
<p>processors
<em class="RFC2119" title="MUST NOT in RFC 2119 context">MUST
NOT</em>
treat them as fatal errors.</p>
</li>
</ul>
</a></div>
</blockquote>
<span class="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>
</body>
</html>
--------------010904050201030102000309--
--===============0566996619==
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]
--===============0566996619==--