"andrew cooke" <[EMAIL PROTECTED]> wrote on 03/17/2006 10:45:00 AM:

> Hi,
> 
> I have code with the line:
>   element.setIdAttribute(ID, true);
> where element is an instance of org.w3c.dom.NodeList and the base 
document
> was created via javax.xml.parsers.DocumentBuilderFactory.newInstance() \
> .newDocumentBuilder().newDocument()
> 
> This gives the error:
>   java.lang.AbstractMethodError:
> org.apache.xerces.dom.ElementImpl.setIdAttribute(Ljava/lang/String;Z)V
>
> I am using Java 1.5.0_04-b05 (JAXP 1.3; Xerces-J 2.6.2) on Suse 9.3.

Element.setIdAttribute() [1] is a DOM Level 3 method. DOM Level 3 has only 
been supported in the standard distribution since Xerces 2.7.0. In earlier 
versions there was experimental support for DOM Level 3 which you could 
access by building Xerces with a special build target. The implementation 
wasn't complete until Xerces 2.7.0. You'll run into problems if the API 
and implementation versions are out of synch.

> After some investigation it seems that this only happens when Xerces 
2.0.2
> appears on the classpath.  This is true even if I explcitly include (in
> addition to 2.0.2) Xerces 2.6.2 (rather than relying on JAXP) and use
>   -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=
>     org.apache.xerces.parsers.StandardParserConfiguration
> 
> Questions:
> - Is there any way to avoid this error *without* cleaning old versions 
of
> Xerces out of the claspath?

If you have multiple versions of Xerces on your classpath, whichever one 
is found first by the ClassLoader wins. You have to fix your classpath.

> - And is cleaning old versions of Xerces out of the classpath guaranteed
> to fix this?

Yes, provided that the remaining version of Xerces is 2.7.0 or higher.
 
> We deploy code in rather complex environments (JBoss and Mule/Spring) 
and
> use Maven to package all dependencies, so excluding jars is not going to
> be trivial.  If there is a way to configure my code to work without 
doing
> this, I would appreciate knowing how.
> 
> I thought this would be a FAQ, but apart from the XMLParserConfiguration
> setting couldn't find anything relevant on the web site.  Apologies if I
> missed something.
> 
> Thanks,
> Andrew
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

[1] 
http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-ElSetIdAttr

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to