[jdom-interest] Runtime Dependency of JDOM => saxpath

Laurent Bihanic laurent.bihanic at atosorigin.com
Fri Apr 2 00:43:26 PST 2004


Hi,

Antoine Lévy-Lambert wrote:
> Since saxpath is deprecated and merged under new package names into jaxen,
> can you replace the package names of saxpath with their equivalents in 
> jaxen ?

JDOM has a dependency to saxpath because, in Jaxen 1.0, JDOMXPath constructors 
expose the SAXPathException.

The attached patch removes this dependency in JaxenXPath.java (removal of the 
import and catching of the generic Exception instead of SAXPathException) and 
fixes the build.xml not to explicitely reference saxpath.jar.

This patch has been tested against both Jaxen 1.0 FCS (and its current 
"installation" in jdom/lib) and Jaxen 1.1 beta2.

Laurent
-------------- next part --------------
Index: JaxenXPath.java
===================================================================
RCS file: /home/cvspublic/jdom/src/java/org/jdom/xpath/JaxenXPath.java,v
retrieving revision 1.16
diff -u -r1.16 JaxenXPath.java
--- JaxenXPath.java	6 Feb 2004 09:28:32 -0000	1.16
+++ JaxenXPath.java	2 Apr 2004 10:02:32 -0000
@@ -62,7 +62,6 @@
 import org.jaxen.*;
 import org.jaxen.jdom.*;
 import org.jdom.*;
-import org.saxpath.*;
 
 
 /**
@@ -282,7 +281,7 @@
          xPath = new JDOMXPath(expr);
          xPath.setNamespaceContext(new NSContext());
       }
-      catch (SAXPathException ex1) {
+      catch (Exception ex1) {
          throw new JDOMException(
                         "Invalid XPath expression: \"" + expr + "\"", ex1);
       }
-------------- next part --------------
Index: build.xml
===================================================================
RCS file: /home/cvspublic/jdom/build.xml,v
retrieving revision 1.49
diff -u -r1.49 build.xml
--- build.xml	17 Feb 2004 02:03:42 -0000	1.49
+++ build.xml	2 Apr 2004 10:33:31 -0000
@@ -22,12 +22,8 @@
                              Defaults to ${lib.dir}/xml-apis.jar
         - parser.jar         The JAR containing the XML parser to use.
                              Defaults to ${lib.dir}/xerces.jar
-        - jaxen-jdom.jar     The JAR containing the Jaxen adapter for JDOM.
-                             Defaults to ${lib.dir}/jaxen-jdom.jar
-        - jaxen-core.jar     The JAR containing the core Jaxen API
-                             Defaults to ${lib.dir}/jaxen-core.jar
-        - jaxen-saxpath.jar  The JAR containing the SAXPath API Jaxen relies
-                             on. Defaults to ${lib.dir}/saxpath.jar
+        - jaxen.lib.dir      The directory containing the Jaxen JAR libraries.
+                             Defaults to ${lib.dir}
      -->
     <property file="${user.home}/jdom.build.properties" />
     <property file="${basedir}/build.properties" />
@@ -71,17 +67,17 @@
     <property name="xml-apis.jar"       value="${lib.dir}/xml-apis.jar"/>
     <property name="parser.jar"         value="${lib.dir}/xerces.jar"/>
     <property name="jdom-core"          value="${build.dest}"/>
-    <property name="jaxen-jdom.jar"     value="${lib.dir}/jaxen-jdom.jar"/>
-    <property name="jaxen-core.jar"     value="${lib.dir}/jaxen-core.jar"/>
-    <property name="jaxen-saxpath.jar"  value="${lib.dir}/saxpath.jar"/>
+    <property name="jaxen.lib.dir"      value="${lib.dir}"/>
 
     <!-- Compilation class path -->
     <path id="compile.class.path">
       <pathelement location="${xml-apis.jar}"/>
       <pathelement location="${parser.jar}"/>
-      <pathelement location="${jaxen-jdom.jar}"/>
-      <pathelement location="${jaxen-core.jar}"/>
-      <pathelement location="${jaxen-saxpath.jar}"/>
+
+      <fileset dir="${jaxen.lib.dir}">
+        <include name="jaxen-*.jar"/>
+        <include name="saxpath*.jar"/>
+      </fileset>
 
       <!-- We used to include the CLASSPATH environment variable in 
            compilation path as it might contain the path to the JDK 1.1 


More information about the jdom-interest mailing list