<!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
}
SPAN.EmailFormatvorlage19 {
        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>Yes...I am using JDK 1.4.1_01, Xerces 2.4.0, Xalan
2.5.1, JDOM b9, and no IDE (TextPad)...I am indifferent to using IDE's :)...my
classpath variables are set properly and its strange that I continue to get the
same error message despite knowing that the XPath expression is correct...here
is error appears when I use the getMessage method in the body of the catch
statement...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><STRONG>Invalid XPath expression:
"//resources/dms[@name='MySQL']/data_source[@name='Login']/url": wrapped
exception<BR></STRONG></FONT><FONT face=Arial size=2></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>It's crazily strange that I can use every other
JDOM/DOM API functionalities beside XPath which tells me that JDOM is properly
setup...this is getting on my nerves...please help...thanks...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV><FONT face=Arial size=2>
<DIV>
<HR>
</DIV>
<DIV> </DIV></FONT>
<DIV><STRONG>Java source<BR></STRONG><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><FONT
face=Arial size=2> SAXBuilder sax_obj = new
SAXBuilder();<BR> Document doc = sax_obj.build(new
File("weather.xml"));<BR> try {<BR> XPath xpath =
XPath.newInstance(path);<BR> Element node =
(Element)xpath.selectSingleNode(doc);<BR> System.out.println("<A
href="\t">URL:\t</A>" +
node.getTextNormalize());<BR> }<BR> catch(JDOMException
excpt)
{<BR> System.out.println(excpt.getMessage());<BR>// excpt.printStackTrace();<BR> }<BR></FONT></DIV>
<DIV><BR> System.out.println("<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>}</DIV>
<DIV><BR> </DIV>
<DIV>
<HR>
</DIV>
<DIV><FONT face=Arial size=2></FONT><BR><STRONG>XML
source<BR></STRONG><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></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>AH</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> Monday, June 23, 2003 2:13 AM</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
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hello!</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">Strange that it
doesn`t work! The program work well with me! May be you have not all the
libraries correctly installed!</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">I use JBuilder 6
Entreprise Edition, JAVA 1.4.1_02, Xerces_2.3.0, Xalan_2.5.D1 and
JDOM-b9-rc2.</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">Anyway, If I don’t
modify the string path I obtain a
java.lang.NullPointerException.</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">Which IDE do you use?
Can you give me some details?</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">You can also try to
use a IDE if you don’t yet use one! Eclipse and NetBeans are free! And
JBuilder personal is for free too!</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><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> Sonntag, 22. Juni 2003
22:47<BR><B><SPAN style="FONT-WEIGHT: bold">An:</SPAN></B> Zufferey, Michael;
JDOM Interest<BR><B><SPAN style="FONT-WEIGHT: bold">Betreff:</SPAN></B> Re:
[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>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">Thanks for the help...I made the
change you suggested and I get the following error
message...</SPAN></FONT></P></DIV>
<DIV>
<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>
<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>
<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: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 . .
.</SPAN></FONT></P></DIV>
<DIV>
<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>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">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><B><FONT
face=Arial><SPAN
style="FONT-FAMILY: Arial">//resources/dms[@name='MySQL']/data_source[@name='Login']/url</SPAN></FONT></B></STRONG>
to <STRONG><B><FONT face=Arial><SPAN
style="FONT-FAMILY: Arial">resources/dms[@name='MySQL']/data_source[@name='Login']/url</SPAN></FONT></B></STRONG>
is because I got the same error so I thought the expression was wrong...Please
help...Thanks...</SPAN></FONT></P></DIV>
<DIV>
<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>
<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>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">ALBERT</SPAN></FONT></P></DIV>
<DIV>
<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>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<BLOCKQUOTE
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0cm; BORDER-TOP: medium none; PADDING-LEFT: 4pt; PADDING-BOTTOM: 0cm; MARGIN: 5pt 0cm 5pt 3.75pt; BORDER-LEFT: black 1.5pt solid; PADDING-TOP: 0cm; BORDER-BOTTOM: medium none">
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face=Arial size=2><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">----- Original Message -----
</SPAN></FONT></P></DIV>
<DIV style="font-color: black">
<P class=MsoNormal style="BACKGROUND: #e4e4e4; MARGIN-LEFT: 35.4pt"><B><FONT
face=Arial size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">From:</SPAN></FONT></B><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <A
title=michael.zufferey@joanneum.at
href="mailto:michael.zufferey@joanneum.at">Zufferey, Michael</A>
</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><B><FONT face=Arial
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">To:</SPAN></FONT></B><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> <A
title=ahives@hotmail.com href="mailto:ahives@hotmail.com">AH</A>
</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><B><FONT face=Arial
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">Sent:</SPAN></FONT></B><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> Sunday,
June 22, 2003 12:50 PM</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><B><FONT face=Arial
size=2><SPAN
style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: Arial">Subject:</SPAN></FONT></B><FONT
face=Arial size=2><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"> AW:
[jdom-interest] Problem running JDOM app using XPath</SPAN></FONT></P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt"><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 style="MARGIN-LEFT: 35.4pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P>
<P class=MsoNormal style="MARGIN-LEFT: 70.8pt"><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: 70.8pt"><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: 70.8pt"><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: 70.8pt"><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: 70.8pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 70.8pt"><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: 70.8pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 70.8pt"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT> </P></DIV>
<DIV>
<P class=MsoNormal style="MARGIN-LEFT: 70.8pt"><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: 70.8pt; MARGIN-RIGHT: 0cm"><FONT
face="Times New Roman" size=3><SPAN
style="FONT-SIZE: 12pt"><BR><BR>AH</SPAN></FONT></P></DIV></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></BODY></HTML>