[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Mon Jan 14 23:00:45 UTC 2008
gordonp
Mon Jan 14 18:00:45 EST 2008
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui
In directory dev.open-bio.org:/tmp/cvs-serv8988/src/main/ca/ucalgary/seahawk/gui
Modified Files:
MobyContentPane.java
Log Message:
Updates for javax.xml.xpath support rather than Aapache Xalan
moby-live/Java/src/main/ca/ucalgary/seahawk/gui MobyContentPane.java,1.16,1.17
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2008/01/07 22:19:14 1.16
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/gui/MobyContentPane.java 2008/01/14 23:00:45 1.17
@@ -12,12 +12,12 @@
import org.biomoby.shared.parser.ServiceException;
import org.w3c.dom.*;
+import org.xml.sax.InputSource;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
-import org.apache.xpath.*;
-import org.apache.xpath.objects.*;
+import javax.xml.xpath.*;
import javax.swing.*;
import javax.swing.event.*;
@@ -896,29 +896,26 @@
// Build and run the XPath statement
Element mobyObject = null;
NodeList idSearchResult = null;
- XObject xobject = null;
+ Object xobject = null;
try{
- xobject = XPathAPI.eval(domDoc, childXPath);
+ xobject = XPathFactory.newInstance().newXPath().evaluate(childXPath,
+ new InputSource(targetURL.openStream()),
+ XPathConstants.NODESET);
// Check the results
- if(xobject instanceof XNodeSet){
- idSearchResult = ((XNodeSet) xobject).nodelist();
- }
- else if(xobject != null){
- logger.warn("Output of XPath was not a XNodeSet as expected, found " +
- xobject.getClass().getName());
- return null;
+ if(xobject != null){
+ idSearchResult = (NodeList) xobject;
}
else{
logger.warn("Could not find Moby object in document " + currentURL +
- ", referred to by the reference ID in Moby link " + targetURL +
- " (document changed?)");
+ ", referred to by the reference ID in Moby link " + targetURL +
+ " (document changed?)");
return null;
}
}
- catch(TransformerException te){// Syntax error
+ catch(Exception e){// Syntax error
logger.error("Error: Could not search Moby data instance for XPath " +
- childXPath + "):" + te);
+ childXPath + "):" + e);
return null;
}
More information about the MOBY-guts
mailing list