[jdom-interest] org.jdom.contrib.ids?

Laurent Bihanic laurent.bihanic at atosorigin.com
Wed Apr 2 08:00:21 PST 2003


Alfredo Aldundi wrote:
> I've just downloaded jdom-contrib and tried to use the 
> org.jdom.contrib.ids contribution. However, with the supplied test 
> program TestIds it does not work. I call:
>  > java TestIds testIds.xml a
> but TestIds reports that this id does not exist (however, it is clearly 
> in the testIds.xml file...). By the way, TestIds does not find a single 
> id in the document...
> 
> I tried to find out the attribute type of the name attribute. I found 
> out that the type is 0 (=UNDECLARED_ATTRIBUTE) and not 2 (=ID_ATTRIBUTE) 
> as it should be. The name attribute is clearly defined as type ID in the 
> DTD. So I guess that this is not a problem of org.jdom.contrib.ids 
> (correct?). May it be that my XML parser does not handle this correctly?

Normally, a parser is required to parse any DTD declared in the document to 
resolve entities and, by loading the DTD, knows the type of each attribute.
If your parser doesn't do, try forcing document validation in TestIds.java by 
using:
       SAXBuilder builder = new SAXBuilder(true);

Laurent




More information about the jdom-interest mailing list