Problems with XML DB api
Monday, 8 March 2010 · 2 messages
JK
Jiří Kadlec8 Mar 2010 10:22 #
Hi,
I'm having a problem with XML DB, when I'm trying to access result as DOM. I'm using this code sequence:
if (res instanceof XMLResource){
XMLResource resource = (XMLResource) res;
Node node = resource.getContentAsDOM();
System.out.println("Get content: " + resource.getContent());
System.out.println("Node je: " + node.getNodeName());
}everytihng goes ok, when i use resource.getContent(), i got expected results but when I try to use resource.getContetAsDOM() a got following exception:
Exception in thread "main" java.lang.NullPointerException
at org.basex.query.item.DBNode.<init>(DBNode.java:50)
at org.basex.api.xmldb.BXXMLResource.getContentAsDOM(BXXMLResource.java:144)
at testmxquery.XQueryDatabaseSample.main(XQueryDatabaseSample.java:186)
Java Result: 1I'm using modified example from your web site.
Thanks for your help
Jiri
CG
Christian Grün8 Mar 2010 19:41 #
Jiří,
it might be interesting to know if the problems are solved with the latest builds of BaseX and the BaseX APIs (6.03), which are found at..
http://basex.org/maven/org/basex/
If you work with the latest sources anyway, please feel free to send us some runnable Java code.
Thanks,
Christian
Quoted text · Jiří Kadlec · 31 lines
On Mon, Mar 8, 2010 at 10:22 AM, Jiří Kadlec <jir.kadlec at post.cz> wrote: > Hi, > > I'm having a problem with XML DB, when I'm trying to access result as DOM. I'm using this code sequence: > > if (res instanceof XMLResource){ > XMLResource resource = (XMLResource) res; > Node node = resource.getContentAsDOM(); > System.out.println("Get content: " + resource.getContent()); > System.out.println("Node je: " + node.getNodeName()); > } > > everytihng goes ok, when i use resource.getContent(), i got expected results but when I try to use resource.getContetAsDOM() a got following exception: > > Exception in thread "main" java.lang.NullPointerException > at org.basex.query.item.DBNode.<init>(DBNode.java:50) > at org.basex.api.xmldb.BXXMLResource.getContentAsDOM(BXXMLResource.java:144) > at testmxquery.XQueryDatabaseSample.main(XQueryDatabaseSample.java:186) > Java Result: 1 > > > I'm using modified example from your web site. > > Thanks for your help > > Jiri > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery