<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1170" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" size=3>Hello
everybody...I am using JDOM's XPath facility for the first time and<BR>have
followed all the rules on written proper XPath expressions...I have<BR>also
followed the rules in the program logic to set up XPath using JDOM but<BR>there
seems to be a major problem...Not just with my program but I get<BR>pretty much
the same error message when I try to run the sample programs<BR>that come with
Jaxen for the JDOM API...I don't know were I am going wrong<BR>here...please
help...I have provided a short program and xml file for<BR>testing
purposes...could it be that I need to install something else...I<BR>have the
latest version of Jaxen and JDOM installed...My JDOM and Jaxen APIs<BR>are
recognized by the JVM...don't understand it...thanks in advance for
any<BR>help...<BR><BR><BR>Java source<BR><BR>import org.jdom.Document;<BR>import
org.jdom.Element;<BR>import org.jdom.JDOMException;<BR>import
org.jdom.input.SAXBuilder;<BR>import java.io.File;<BR>import
org.jdom.xpath.XPath;<BR><BR><BR>public class TestXPath<BR>{<BR> public
static void main(String [] args) throws Exception<BR> {<BR> String
path
=<BR>"resources/dms[@name='MySQL']/data_source[@name='Login']/url";<BR><BR>
SAXBuilder sax_obj = new SAXBuilder();<BR> Document doc =
sax_obj.build(new File("config.xml"));<BR> XPath xpath =
XPath.newInstance(path);<BR> Element node =
(Element)XPath.selectSingleNode(doc.getRootElement(),<BR>path);<BR><BR>
System.out.println("</FONT><A href="\t"><FONT face="Times New Roman"
size=3>URL:\t</FONT></A><FONT face="Times New Roman" size=3>" +
node.getTextNormalize());<BR> }<BR>}<BR><BR><BR><BR>XML
source<BR><BR><?xml version="1.0"
encoding="UTF-8"?><BR><resources><BR> <dms name="MySQL"
driver="com.mysql.jdbc.Driver"><BR> <data_source name="Login"
type="database"><BR>
<url>jdbc:mysql://localhost/login</url><BR>
</data_source><BR> <data_source name="Authentication"
type="database"><BR>
<url>jdbc:mysql://localhost/authentication</url><BR>
</data_source><BR> <data_source name="Key"
type="database"><BR>
<url>jdbc:mysql://localhost/user_key</url><BR>
</data_source><BR> <data_source name="ID"
type="database"><BR>
<url>jdbc:mysql://localhost/id</url><BR>
</data_source><BR> </dms><BR></resources><BR></FONT></FONT></DIV><FONT
face=Arial size=2><FONT face="Times New Roman"
size=3></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3>I get the following error message when the
above program is ran against the above xml
file...</FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3><FONT face=Arial size=2>Exception in thread "main"
org.jdom.JDOMException: Invalid XPath expression:
"resources/dms[@name='MySQL']/data_source[@<BR>name='Login']/url": wrapped
exception<BR> at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:288)<BR>
at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:101)<BR>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)<BR> at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<BR>
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<BR>
at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)<BR>
at
org.jdom.xpath.XPath.newInstance(XPath.java:136)<BR>
at TestXPath.main(TestXPath.java:17)<BR>Caused by: org.jaxen.JaxenException:
wrapped exception<BR> at
org.jaxen.BaseXPath.<init>(BaseXPath.java:142)<BR>
at
org.jaxen.BaseXPath.<init>(BaseXPath.java:157)<BR>
at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:103)<BR>
at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:284)<BR>
... 7 more<BR>Caused by: org.jaxen.JaxenException: wrapped
exception<BR> at
org.jaxen.BaseXPath.<init>(BaseXPath.java:142)<BR>
at
org.jaxen.BaseXPath.<init>(BaseXPath.java:157)<BR>
at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:103)<BR>
at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:284)<BR>
at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:101)<BR>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)<BR> at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<BR>
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<BR>
at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)<BR>
at
org.jdom.xpath.XPath.newInstance(XPath.java:136)<BR>
at TestXPath.main(TestXPath.java:17)<BR>Caused by: org.jaxen.JaxenException:
wrapped exception<BR> at
org.jaxen.BaseXPath.<init>(BaseXPath.java:142)<BR>
at
org.jaxen.BaseXPath.<init>(BaseXPath.java:157)<BR>
at
org.jaxen.jdom.JDOMXPath.<init>(JDOMXPath.java:103)<BR>
at
org.jdom.xpath.JaxenXPath.setXPath(JaxenXPath.java:284)<BR>
at
org.jdom.xpath.JaxenXPath.<init>(JaxenXPath.java:101)<BR>
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)<BR> at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<BR>
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<BR>
at
java.lang.reflect.Constructor.newInstance(Constructor.java:274)<BR>
at
org.jdom.xpath.XPath.newInstance(XPath.java:136)<BR>
at TestXPath.main(TestXPath.java:17)<BR>Press any key to continue . .
.</FONT></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3><FONT face=Arial
size=2></FONT></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3><FONT face=Arial
size=2></FONT></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial size=2><FONT face=Arial size=2><FONT
face="Times New Roman" size=3><FONT face=Arial size=2>Can anybody help...I am
thinking that there is a problem with Jaxen but dont know enough about the API
to figure out what...please help...</FONT></DIV>
<DIV><FONT face=Arial
size=2></FONT><BR><BR>AH</FONT><BR><BR><BR></DIV></FONT></FONT></FONT></DIV></FONT></DIV></BODY></HTML>