|
I've created the collection and added a few
documents. I've queried the collection from the command line and get the
right results. I'm no trying to do the same thing from a Java program to
get to grips with the XML:DB Api. The code I'm using is below. Any
ideas where I'm going wrong will be gratefully received.
Cheers
Richard
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*; import org.xmldb.api.*; public class ConnectToDbxml {
/**
*/
public static void main(String args[]) throws Exception { Collection col = null; try{ String driver = "org.dbxml.client.xmldb.DatabaseImpl"; Class c = Class.forName(driver); Database database = (Database)c.newInstance(); DatabaseManager.registerDatabase(database); col = DatabaseManager.getCollection("xmldb:xindice:///db/myexamples"); String xpath = "/person"; XPathQueryService service = (XPathQueryService)col.getService("XPathQueryService", "1.0"); ResourceSet resultSet = service.query(xpath); ResourceIterator results = resultSet.getIterator(); while(results.hasMoreResources()){ Resource res = results.nextResource(); System.out.println((String)res.getContent()); } } catch (XMLDBException e) { System.err.println("XML:DB Exception occured " + e.errorCode); } finally { if (col != null) { col.close(); } } } }
|
- exception error code Richard Featherstone
- Re: exception error code Bahman Kalali
- Re: exception error code Richard Featherstone
- Re: exception error code Mark J. Stang
- Re: exception error code Richard Featherstone
- Re: exception error code Mark J. Stang
- Re: exception error code Kimbro Staken
- Re: exception error code Mark J. Stang
