Re: Parsing a MODS-document with validation fails

Rolf Lear <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <[email protected]>
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<[email protected]>  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/[email protected]
> ------------------------------------------------------------------------
> 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.
> ------------------------------------------------------------------------

_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.