[jdom-interest] Parsing a MODS-document with validation fails

Jason Hunter jhunter at servlets.com
Sun Aug 7 20:34:47 PDT 2011


I tested the same thing with DOMBuilder.  It shows two attributes with the same name on the same element.

name: type
value: simple

name: type
value: personal

My guess is in Thomas' sample code it's the transform action that did the ns0 addition.

JDOM doesn't error out when it sees this, the code just lets setAttribute() overwrite any previous assignments.

It seems like the input is technically malformed.  Has there been official advice given on what an object model should do in this case?

-jh-

On Aug 7, 2011, at 12:42 PM, Bradley S. Huffman wrote:

> I did a simple test and printed out what was being given to SAXHandler
> by the parser.  Sure enough, on this document when validation is turn
> on, the SAX parser is reporting two attributes with the same qname
> (which happens to be the local name since they are both unprefix), but
> in different namespaces.
> 
> JDOM should take the events as presented and build a object tree to
> represent it.  It shouldn't "generate" anything.  However, in this
> case I don't know who to point the finger at, but it's not JDOM.
> 
> Elliotte, are you still lurking around?
> 
> ********************************************
> namespaceURI = http://www.loc.gov/mods/v3
> localName = name
> qName = name
> attribute local name = type
> attribute qname = type
> attribute uri =
> attribute type = CDATA
> attribute value = personal
> attribute local name = type
> attribute qname = type
> attribute uri = http://www.w3.org/1999/xlink
> attribute type = CDATA
> attribute value = simple
> ********************************************
> namespaceURI = http://www.loc.gov/mods/v3
> localName = namePart
> qName = namePart
> attribute local name = type
> attribute qname = type
> attribute uri =
> attribute type = CDATA
> attribute value = family
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com




More information about the jdom-interest mailing list