<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.5762.3">
<TITLE>org.jdom.JDOMException: java.lang.reflect.InvocationTargetException</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hello there,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I am trying to create an XML document using JDOM. At the same time I also need to dynamically add addtional elements to the XML document as I traverse a dataset from the DB. I am using the following code:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">----------------------- START CODE ---------------------</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"> Element root = new Element("events");</FONT>
<BR><FONT SIZE=2 FACE="Arial"> Document doc = new Document(root);</FONT>
<BR><FONT SIZE=2 FACE="Arial"> root.addContent(new Element("categories"));</FONT>
<BR><FONT SIZE=2 FACE="Arial"> StringBuffer buf = new StringBuffer("/events/categories/category[@id='1']");</FONT>
<BR><FONT SIZE=2 FACE="Arial"> XPath path = XPath.newInstance(buf.toString());</FONT>
<BR><FONT SIZE=2 FACE="Arial"> Element curCategory = (Element)path.selectSingleNode(root);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">----------------------- END CODE ---------------------</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">A org.jdom.JDOMException: java.lang.reflect.InvocationTargetException error is thrown at the point at which an xpath object is about to be created[line 5]. I don't know why this error is being thrown. Is it the xpath expression or the context? Can someone help please?</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Regards</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Olu Adelaja</FONT>
</P>
</BODY>
</HTML>