[jdom-interest] Parsing a MODS-document with validation fails
Rolf Lear
jdom at tuis.net
Sat Aug 13 14:14:18 PDT 2011
Hi Brad.
In this case I think the issue is too 'grey' to squarely lay the blame
on any particular component. The use-case is such that it relies on a
number of different shortcomings in a number of tools, including JDOM.
Although the 'test cases' I put together illustrates the underlying
problem (that there's no namespace prefix given to attributes that are
'sourced' from the XSD), the initial symptom as reported by Thomas
is/was that JDOM was overwriting the value of his 'type' attribute with
the value of the 'type' attrribute in the xlink namespace.
In other words, if there is no change made to SAXHandler, then we make a
'broken' situation even worse. Saying "when XMLSchema specification is
revised, and all the parsers do the 'right thing' we will give the right
result" feels a little cheap.
At a minimum, the SAXHandler has to be able to identify attributes that
are in a namespace, but without a prefix, and then to ignore *that*
attribute instead of potentially corrupting a different attribute.
On the other hand, the fix/workaround for the problem is relatively
trivial, easy to confine to just the scope of the issue, and it is safe
for when we do (eventually) have parsers that provide a correct (or
generated) prefix.
The concept of the user having to apply a filter or wrapper to get
sensible results is not pretty.
One other thought, in order to get to this state, you have to declare
your Parser to be namespace-aware... and then, after asking for the
namspaces JDOM then does its processing based on the prefix, not the
namespace...
Rolf
On Fri, 12 Aug 2011 17:51:21 Bradley S. Huffman wrote
> However JDOM, or any other project can't and shouldn't be adding
> kludges because another group won't fix there code and keeps 'passing
> the buck'. Therefore, I support Michael's suggestion of handling it
> with a filter or wrapper, but I do not support changing SAXHandler in
> any way.
>
> On Wed, Aug 10, 2011 at 3:14 PM, Rolf Lear<jdom at tuis.net> wrote:
>
> > That issue is marked "Won't fix", with the comment: I agree it's a bug, but
> > it's not that easy to fix. The problem is what prefix to use for the new
> > attribute. I'll think about it more.
>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> ------------------------------------------------------------------------
> This email and any files transmitted with it are confidential and
> proprietary to Algorithmics Incorporated and its affiliates
> ("Algorithmics"). If received in error, use is prohibited. Please
> destroy, and notify sender. Sender does not waive confidentiality or
> privilege. Internet communications cannot be guaranteed to be timely,
> secure, error or virus-free. Algorithmics does not accept liability
> for any errors or omissions. Any commitment intended to bind
> Algorithmics must be reduced to writing and signed by an authorized
> signatory.
> ------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.jdom.org/pipermail/jdom-interest/attachments/20110813/9ece3188/attachment.html>
More information about the jdom-interest
mailing list