You can use
doc.getElementById("targetID");
This returns the Element whose ID is "targetID". If no such element
exists, returns null.
-Pavani
Shang, Crystal wrote :
>
> Is there a way or an API in Xerces to locate an element in a document with
> certain Id attribute? E.g, given the following XML file, can we locate the
> element whose id is "targetID" quickly without the help of XPath evaluation?
> I'm trying to remove the XPath dependency in our code because of some design
> issues.
>
> ......
> <myElement Id="targetID">...</myElement>
> ......
>
--
Pavani Mukthipudi
Sun Microsystems, Inc.
Phone: 080 - 2298989 Extn: 87390