I've tried to solve this problem myself and can't find an easy solution. If all you want is /x/y/z type stuff and you aren't worried about getting a specific instance of 'z' in a specific instance of 'y' it is really easy to build this yourself. You just keep getting the nodeName of the parent until you get to the document node. If you want to get a specific instance, then things get tricky. The possible combinations can be very difficult to programmatically differentiate. If there are two instances of 'z', they may differ in an example doc both by the presence of particular text content and by the value of an attribute (or the presence of an attribute). While both will be sufficient to differentiate in your instance, this may not work in all instances. It also may be necessary to specify both, or even specify the absence of an attribute (how do you do that one!?)
I'm interested if anyone has any out-of-the-box ideas on this one, as I'd still love to have an answer for it! ;) -----Original Message----- From: Dirk Schalle [mailto:[EMAIL PROTECTED] Sent: Monday, December 18, 2006 7:02 AM To: j-users@xerces.apache.org Subject: Construct XPath from DOM Element ... Is there an API, which takes a DOM tree structure and constructs the XPath for any given element or attribute within this DOM tree? Thank you, Dirk Schalle --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]