<!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>@font-face {
        font-family: Tahoma;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 70.85pt 70.85pt 2.0cm 70.85pt; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.EmailFormatvorlage17 {
        COLOR: navy; FONT-FAMILY: Arial
}
DIV.Section1 {
        page: Section1
}
</STYLE>
</HEAD>
<BODY lang=DE vLink=blue link=blue bgColor=white>
<DIV><FONT face=Arial size=2>Thanks for the help...I made the change you
suggested and I get the following error message...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><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:18)<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:18)<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:18)<BR>Press any key to continue . .
.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Could it be that something is not installed
properly...if so what could it be...I am clueless on this issue...The reason why
I changed the string from
<STRONG>//resources/dms[@name='MySQL']/data_source[@name='Login']/url</STRONG>
to <STRONG>resources/dms[@name='MySQL']/data_source[@name='Login']/url</STRONG>
is because I got the same error so I thought the expression was wrong...Please
help...Thanks...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>ALBERT</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=michael.zufferey@joanneum.at
href="mailto:michael.zufferey@joanneum.at">Zufferey, Michael</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=ahives@hotmail.com
href="mailto:ahives@hotmail.com">AH</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Sunday, June 22, 2003 12:50
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> AW: [jdom-interest] Problem
running JDOM app using XPath</DIV>
<DIV><BR></DIV>
<DIV class=Section1>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hello</SPAN></FONT><FONT
face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">!</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Your program and the
“config.xml” file are good!</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">The problem is the
string path! The XPATH expression is incorrect! As it is, it will not
work!</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Replace your original
path with this one:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">String path =
"/resources/dms[@name='MySQL']/data_source[@name='Login']/url";</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Or with this if you
prefer (check your necessities before):</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">String path =
"//resources/dms[@name='MySQL']/data_source[@name='Login']/url";</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">And you will obtain
as result:</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">URL:
jdbc:mysql://localhost/login</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Best
wishes,</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Michael</SPAN></FONT></P>
<P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN lang=EN-GB
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Tahoma size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">-----Ursprüngliche
Nachricht-----<BR><B><SPAN style="FONT-WEIGHT: bold">Von:</SPAN></B> AH
[mailto:ahives@hotmail.com] <BR><B><SPAN
style="FONT-WEIGHT: bold">Gesendet:</SPAN></B> Samstag, 21. Juni 2003
21:01<BR><B><SPAN style="FONT-WEIGHT: bold">An:</SPAN></B> JDOM
Interest<BR><B><SPAN style="FONT-WEIGHT: bold">Betreff:</SPAN></B>
[jdom-interest] Problem running JDOM app using XPath</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<DIV>
<DIV>
<DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt">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("</SPAN></FONT><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><A href="/t"><FONT
face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt; FONT-FAMILY: 'Times New Roman'">URL:\t</SPAN></FONT></A></SPAN></FONT>"
+ 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></P></DIV></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt">I get the following error message when
the above program is ran against the above xml
file...</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">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 . .
.</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">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...</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal
style="MARGIN-BOTTOM: 12pt; MARGIN-LEFT: 35.4pt; MARGIN-RIGHT: 0cm"><FONT
face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><BR><BR>AH</SPAN></FONT><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><BR><BR></SPAN></FONT></P></DIV></DIV></DIV></DIV></BLOCKQUOTE></BODY></HTML>