You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by Miguel Angel Urrutia Soler <ur...@hotmail.com> on 2002/01/26 11:55:55 UTC
Subqueries
Hi All!
how i can make a query from a ResourceSet? anybody knows how i can make queries from queries or if it's supported the and operator in xpathqueries?
thanks! i appreciated any help...
Miguel Angel Urrutia
RE: NullpointerException
Posted by Stéphane Nimsgern <sn...@otoobe.com>.
hi,
XMLResource.RESOURCE_TYPE might be null, the second parameter of
createResource
is a String representing a resource type. You can use as far as I know:
"XMLResource" and "BinaryResource".
-{-----Message d'origine-----
-{De : Øyvind Vestavik [mailto:Oyvind.Vestavik@idi.ntnu.no]
-{Envoyé : lundi 28 janvier 2002 15:06
-{À : xindice-users@xml.apache.org
-{Objet : NullpointerException
-{
-{
-{
-{
-{I am passing a well formed xml document as a DOM document into a method
-{that is supposed to insert it into a dbxml database. But whenever i start
-{my program i get a java.lang.NullpointerExeption
-{
-{I have found the line causing the trouble and it goes like this
-{
-{XMLResource resource =
-{ (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
-{
-{Anyone who could tell me what's wrong??
-{
-{The whole class/method goes like:
-{
-{import org.xmldb.api.base.*;
-{import org.xmldb.api.modules.*;
-{import org.xmldb.api.*;
-{import org.w3c.dom.Document;
-{import java.io.*;
-{
-{Public class AddDocument{
-{
-{ public void add(Document doc) throws Exception{
-{
-{ Collection col = null;
-{ try{
-{
-{ String driver = "org.dbxml.client.xmldb.DatabaseImpl";
-{ Class c = Class.forName(driver);
-{ Database database = (Database) c.newInstance();
-{
-{DatabaseManager.getCollection("xmldb:dbxml:///db/REAP/Profiles");
-{
-{ String id = "test";
-{
-{ //this is the line where the exception is thrown:
-{ XMLResource document =
-{ (XMLResource) col.createResource(id,
-{XMLResource.RESOURCE_TYPE);
-{
-{ document.setContentAsDom(doc); //doc is the received
-{xml dom document
-{ col.storeResource(document);
-{
-{ }
-{
-{ catch (XMLDBExeption e){
-{ System.err.println("Error occured " + e.errorCode)
-{ }
-{
-{ finally{
-{ if (col !=null){
-{ col.close;
-{ }
-{ }
-{ }
-{}
-{
-{It would really help me if anyone of you knew what's wrong..
-{
-{Thanks Øyvind
-{
-{Øyvind Vestavik
-{Øvre Møllenberggt 44b
-{7014 Trondheim
-{oyvindve@idi.ntnu.no
-{41422911
-{
-{
Re: NullpointerException
Posted by Heinrich Götzger <go...@gmx.net>.
Øyvind,
your col equals null.
add 'col =' in line marked with 8-O. No offence ;-)
So long, hope it helps.
On Mon, 28 Jan 2002, Øyvind Vestavik wrote:
>
>
>I am passing a well formed xml document as a DOM document into a method
>that is supposed to insert it into a dbxml database. But whenever i start
>my program i get a java.lang.NullpointerExeption
>
>I have found the line causing the trouble and it goes like this
>
>XMLResource resource =
> (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
>
>Anyone who could tell me what's wrong??
>
>The whole class/method goes like:
>
>import org.xmldb.api.base.*;
>import org.xmldb.api.modules.*;
>import org.xmldb.api.*;
>import org.w3c.dom.Document;
>import java.io.*;
>
>Public class AddDocument{
>
> public void add(Document doc) throws Exception{
>
> Collection col = null;
> try{
>
> String driver = "org.dbxml.client.xmldb.DatabaseImpl";
> Class c = Class.forName(driver);
> Database database = (Database) c.newInstance();
> 8-O
DatabaseManager.getCollection("xmldb:dbxml:///db/REAP/Profiles");
>
> String id = "test";
>
> //this is the line where the exception is thrown:
> XMLResource document =
> (XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
>
> document.setContentAsDom(doc); //doc is the received xml dom document
> col.storeResource(document);
>
> }
>
> catch (XMLDBExeption e){
> System.err.println("Error occured " + e.errorCode)
> }
>
> finally{
> if (col !=null){
> col.close;
> }
> }
> }
>}
>
>It would really help me if anyone of you knew what's wrong..
>
>Thanks Øyvind
>
>Øyvind Vestavik
>Øvre Møllenberggt 44b
>7014 Trondheim
>oyvindve@idi.ntnu.no
>41422911
>
>
regards
Heinrich
--
http://www.xmlBlaster.org
NullpointerException
Posted by Øyvind Vestavik <Oy...@idi.ntnu.no>.
I am passing a well formed xml document as a DOM document into a method
that is supposed to insert it into a dbxml database. But whenever i start
my program i get a java.lang.NullpointerExeption
I have found the line causing the trouble and it goes like this
XMLResource resource =
(XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
Anyone who could tell me what's wrong??
The whole class/method goes like:
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
import org.w3c.dom.Document;
import java.io.*;
Public class AddDocument{
public void add(Document doc) throws Exception{
Collection col = null;
try{
String driver = "org.dbxml.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.getCollection("xmldb:dbxml:///db/REAP/Profiles");
String id = "test";
//this is the line where the exception is thrown:
XMLResource document =
(XMLResource) col.createResource(id, XMLResource.RESOURCE_TYPE);
document.setContentAsDom(doc); //doc is the received xml dom document
col.storeResource(document);
}
catch (XMLDBExeption e){
System.err.println("Error occured " + e.errorCode)
}
finally{
if (col !=null){
col.close;
}
}
}
}
It would really help me if anyone of you knew what's wrong..
Thanks Øyvind
Øyvind Vestavik
Øvre Møllenberggt 44b
7014 Trondheim
oyvindve@idi.ntnu.no
41422911
Re: Subqueries
Posted by Miguel Angel Urrutia Soler <ur...@hotmail.com>.
Thanks! I did it so... programatically it works fine! but using the command
line tools a I received the message "and was unexpected at this time" i
realize the windows command line sucks!
thanks i hope contributed to your work soon...
----- Original Message -----
From: "Tom Bradford" <br...@dbxmlgroup.com>
To: <xi...@xml.apache.org>
Sent: Saturday, January 26, 2002 1:11 PM
Subject: Re: Subqueries
> On Saturday, January 26, 2002, at 03:55 AM, Miguel Angel Urrutia Soler
> wrote:
> > how i can make a query from a ResourceSet? anybody knows how i can make
> > queries from queries or if it's supported the and operator in
> > xpathqueries?
>
> XPath supports 'and' so you can do something like:
>
> /book[author='Stephen King' and price<10.00]
>
> --
> Tom Bradford - http://www.tbradford.org
> Developer - Apache Xindice (Native XML Database) - http://xml.apache.org
> Creator - Project Labrador (Web Services Framework) -
> http://notdotnet.org
>
>
Re: Subqueries
Posted by Tom Bradford <br...@dbxmlgroup.com>.
On Saturday, January 26, 2002, at 03:55 AM, Miguel Angel Urrutia Soler
wrote:
> how i can make a query from a ResourceSet? anybody knows how i can make
> queries from queries or if it's supported the and operator in
> xpathqueries?
XPath supports 'and' so you can do something like:
/book[author='Stephen King' and price<10.00]
--
Tom Bradford - http://www.tbradford.org
Developer - Apache Xindice (Native XML Database) - http://xml.apache.org
Creator - Project Labrador (Web Services Framework) -
http://notdotnet.org