Re: Parsing a MODS-document with validation fails

Thomas Scheffler <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Organization Friedrich-Schiller-Universität Jena
Message-ID <[email protected]>
Am 08.08.2011 05:58, schrieb Rolf:
> But, as for the ns0 'default' name, I think that is a poor solution, and
> that it should be possible to scan up the tree to find a real prefix for
> that namespace... If the parser is not going to provide it, I think the
> JDOM SAX Handler can fall back on a work-around solution that does not
> 'lose' the attribute - a solution that is a combination of Thomas's fix,
> and a smarter prefix determination routine.

Hi,

that is exactly what "nsURIMapping" and "usedNamespaces" does. On 
"startPrefixMapping()" a prefixMapping is assigned and kept until 
"endPrefixMapping()" called. In unpatched state SAXHandler cleaned those 
mappings after every element, there was no "endPrefixMapping" handler.
The "ns[0-9]+" case is a fallback that is not even used in the MODS-case 
as "xlink" could be resolved properly. It is just in the code to 
definitively not overwrite an attribute in the default namespace.

Hope that clarifies my 2nd patch (2001-07-25) a bit.

regards,

Thomas

_______________________________________________
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.