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 morten svanæs <mo...@web-som-virker.no> on 2003/07/04 00:26:07 UTC
Xpath query
Hi,
I've have a webapp that use Xindice and I use xpath queries like
//THING[contains(FOO,'bar')]
This worked perfectly fine until something happend and now queries like this
don't return anything !
Any suggestions on what I'm doing wrong ?
Morten Svanæs
Re: Xpath query
Posted by morten svanæs <mo...@web-som-virker.no>.
Hi,
I don't understand what you mean by xupdate, I don't use any xupdate.
The error arise on every type of collection/document and document I try to
query.
I downloaded the newest cvs version tonight and that version seems to
work fine.
Morten Svanæs
----- Original Message -----
From: "Mark J. Stang" <ma...@earthlink.net>
To: <xi...@xml.apache.org>
Sent: Friday, July 04, 2003 7:28 PM
Subject: Re: Xpath query
> Hi,
> Can you print out the xml for the xupdate and send that by itself? Also,
the
> document that you added to the collection. I have a test environment
where I
> can test the XML to see if you have everything "coded" correctly.
>
> regards,
>
> Mark
>
> morten svanæs wrote:
>
> > Hi,
> > the query is runned from a class, the source is from the example that is
in
> > the dist.
> > I have only changed the xpath query, se source below.
> > The xindice version is from
> > http://xml.apache.org/dist/xindice/xml-xindice-war-1.1b1.zip
> > I test the class with Intellij IDEA , when I use j2se1.4.2 it makes a
fatal
> > exeception
> > but when I use j2se1.4.1_02 It makes same error but no fatal exeception.
> > It runs on winxp
> > I copied the db data from a xindice 1.0 version .
> >
> > /*
> > * The Apache Software License, Version 1.1
> > *
> > *
> > * Copyright (c) 1999 The Apache Software Foundation. All rights
> > * reserved.
> > *
> > * Redistribution and use in source and binary forms, with or without
> > * modification, are permitted provided that the following conditions
> > * are met:
> > *
> > * 1. Redistributions of source code must retain the above copyright
> > * notice, this list of conditions and the following disclaimer.
> > *
> > * 2. Redistributions in binary form must reproduce the above copyright
> > * notice, this list of conditions and the following disclaimer in
> > * the documentation and/or other materials provided with the
> > * distribution.
> > *
> > * 3. The end-user documentation included with the redistribution,
> > * if any, must include the following acknowledgment:
> > * "This product includes software developed by the
> > * Apache Software Foundation (http://www.apache.org/)."
> > * Alternately, this acknowledgment may appear in the software
itself,
> > * if and wherever such third-party acknowledgments normally appear.
> > *
> > * 4. The names "Xindice" and "Apache Software Foundation" must
> > * not be used to endorse or promote products derived from this
> > * software without prior written permission. For written
> > * permission, please contact apache@apache.org.
> > *
> > * 5. Products derived from this software may not be called "Apache",
> > * nor may "Apache" appear in their name, without prior written
> > * permission of the Apache Software Foundation.
> > *
> > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> > * SUCH DAMAGE.
> > * ====================================================================
> > *
> > * This software consists of voluntary contributions made by many
> > * individuals on behalf of the Apache Software Foundation and was
> > * originally based on software copyright (c) 1999-2001, The dbXML
> > * Group, L.L.C., http://www.dbxmlgroup.com. For more
> > * information on the Apache Software Foundation, please see
> > * <http://www.apache.org/>.
> > *
> > * $Id: Example1.java,v 1.4 2003/06/05 04:00:48 kevinross Exp $
> > */
> >
> > import org.xmldb.api.DatabaseManager;
> > import org.xmldb.api.base.Collection;
> > import org.xmldb.api.base.Database;
> > import org.xmldb.api.base.Resource;
> > import org.xmldb.api.base.ResourceIterator;
> > import org.xmldb.api.base.ResourceSet;
> > import org.xmldb.api.base.XMLDBException;
> > import org.xmldb.api.modules.XPathQueryService;
> >
> > /**
> > * Simple XML:DB API example to query the database.
> > */
> > public class Example1{
> >
> > public static void main(String[] args) throws Exception {
> > Collection col = null;
> > try {
> > String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
> > Class c = Class.forName(driver);
> >
> > Database database = (Database) c.newInstance();
> > DatabaseManager.registerDatabase(database);
> > col =
> >
DatabaseManager.getCollection("xmldb:xindice-embed:///db/something/CORE/Firm
> > a");
> >
> > String xpath = "//firma[contains(navn,'h')]";
> > System.out.println("NAME:"+col);
> > 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 + " " +
> > e.getMessage());
> > }
> > finally {
> > if (col != null) {
> > col.close();
> > }
> > }
> > }
> >
> > }
> >
> > ----- Original Message -----
> > From: "Mark J. Stang" <ma...@earthlink.net>
> > To: <xi...@xml.apache.org>
> > Sent: Friday, July 04, 2003 4:58 PM
> > Subject: Re: Xpath query
> >
> > > What is your command-line and os?
> > >
> > > morten svanæs wrote:
> > >
> > > > Hi,
> > > > I've have a webapp that use Xindice and I use xpath queries like
> > > > //THING[contains(FOO,'bar')]
> > > > This worked perfectly fine until something happend and now queries
like
> > this
> > > > don't return anything !
> > > > Any suggestions on what I'm doing wrong ?
> > > >
> > > > Morten Svanæs
> > >
> > > --
> > > Mark J Stang
> > > System Architect
> > > Cybershop Systems
> > >
> > >
>
> --
> Mark J Stang
> System Architect
> Cybershop Systems
>
>
Re: Xpath query
Posted by "Mark J. Stang" <ma...@earthlink.net>.
Hi,
Can you print out the xml for the xupdate and send that by itself? Also, the
document that you added to the collection. I have a test environment where I
can test the XML to see if you have everything "coded" correctly.
regards,
Mark
morten svanæs wrote:
> Hi,
> the query is runned from a class, the source is from the example that is in
> the dist.
> I have only changed the xpath query, se source below.
> The xindice version is from
> http://xml.apache.org/dist/xindice/xml-xindice-war-1.1b1.zip
> I test the class with Intellij IDEA , when I use j2se1.4.2 it makes a fatal
> exeception
> but when I use j2se1.4.1_02 It makes same error but no fatal exeception.
> It runs on winxp
> I copied the db data from a xindice 1.0 version .
>
> /*
> * The Apache Software License, Version 1.1
> *
> *
> * Copyright (c) 1999 The Apache Software Foundation. All rights
> * reserved.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions
> * are met:
> *
> * 1. Redistributions of source code must retain the above copyright
> * notice, this list of conditions and the following disclaimer.
> *
> * 2. Redistributions in binary form must reproduce the above copyright
> * notice, this list of conditions and the following disclaimer in
> * the documentation and/or other materials provided with the
> * distribution.
> *
> * 3. The end-user documentation included with the redistribution,
> * if any, must include the following acknowledgment:
> * "This product includes software developed by the
> * Apache Software Foundation (http://www.apache.org/)."
> * Alternately, this acknowledgment may appear in the software itself,
> * if and wherever such third-party acknowledgments normally appear.
> *
> * 4. The names "Xindice" and "Apache Software Foundation" must
> * not be used to endorse or promote products derived from this
> * software without prior written permission. For written
> * permission, please contact apache@apache.org.
> *
> * 5. Products derived from this software may not be called "Apache",
> * nor may "Apache" appear in their name, without prior written
> * permission of the Apache Software Foundation.
> *
> * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
> * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
> * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
> * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> * SUCH DAMAGE.
> * ====================================================================
> *
> * This software consists of voluntary contributions made by many
> * individuals on behalf of the Apache Software Foundation and was
> * originally based on software copyright (c) 1999-2001, The dbXML
> * Group, L.L.C., http://www.dbxmlgroup.com. For more
> * information on the Apache Software Foundation, please see
> * <http://www.apache.org/>.
> *
> * $Id: Example1.java,v 1.4 2003/06/05 04:00:48 kevinross Exp $
> */
>
> import org.xmldb.api.DatabaseManager;
> import org.xmldb.api.base.Collection;
> import org.xmldb.api.base.Database;
> import org.xmldb.api.base.Resource;
> import org.xmldb.api.base.ResourceIterator;
> import org.xmldb.api.base.ResourceSet;
> import org.xmldb.api.base.XMLDBException;
> import org.xmldb.api.modules.XPathQueryService;
>
> /**
> * Simple XML:DB API example to query the database.
> */
> public class Example1{
>
> public static void main(String[] args) throws Exception {
> Collection col = null;
> try {
> String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
> Class c = Class.forName(driver);
>
> Database database = (Database) c.newInstance();
> DatabaseManager.registerDatabase(database);
> col =
> DatabaseManager.getCollection("xmldb:xindice-embed:///db/something/CORE/Firm
> a");
>
> String xpath = "//firma[contains(navn,'h')]";
> System.out.println("NAME:"+col);
> 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 + " " +
> e.getMessage());
> }
> finally {
> if (col != null) {
> col.close();
> }
> }
> }
>
> }
>
> ----- Original Message -----
> From: "Mark J. Stang" <ma...@earthlink.net>
> To: <xi...@xml.apache.org>
> Sent: Friday, July 04, 2003 4:58 PM
> Subject: Re: Xpath query
>
> > What is your command-line and os?
> >
> > morten svanæs wrote:
> >
> > > Hi,
> > > I've have a webapp that use Xindice and I use xpath queries like
> > > //THING[contains(FOO,'bar')]
> > > This worked perfectly fine until something happend and now queries like
> this
> > > don't return anything !
> > > Any suggestions on what I'm doing wrong ?
> > >
> > > Morten Svanæs
> >
> > --
> > Mark J Stang
> > System Architect
> > Cybershop Systems
> >
> >
--
Mark J Stang
System Architect
Cybershop Systems
Re: Xpath query
Posted by morten svanæs <mo...@web-som-virker.no>.
Hi,
the query is runned from a class, the source is from the example that is in
the dist.
I have only changed the xpath query, se source below.
The xindice version is from
http://xml.apache.org/dist/xindice/xml-xindice-war-1.1b1.zip
I test the class with Intellij IDEA , when I use j2se1.4.2 it makes a fatal
exeception
but when I use j2se1.4.1_02 It makes same error but no fatal exeception.
It runs on winxp
I copied the db data from a xindice 1.0 version .
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xindice" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999-2001, The dbXML
* Group, L.L.C., http://www.dbxmlgroup.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* $Id: Example1.java,v 1.4 2003/06/05 04:00:48 kevinross Exp $
*/
import org.xmldb.api.DatabaseManager;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.Database;
import org.xmldb.api.base.Resource;
import org.xmldb.api.base.ResourceIterator;
import org.xmldb.api.base.ResourceSet;
import org.xmldb.api.base.XMLDBException;
import org.xmldb.api.modules.XPathQueryService;
/**
* Simple XML:DB API example to query the database.
*/
public class Example1{
public static void main(String[] args) throws Exception {
Collection col = null;
try {
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col =
DatabaseManager.getCollection("xmldb:xindice-embed:///db/something/CORE/Firm
a");
String xpath = "//firma[contains(navn,'h')]";
System.out.println("NAME:"+col);
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 + " " +
e.getMessage());
}
finally {
if (col != null) {
col.close();
}
}
}
}
----- Original Message -----
From: "Mark J. Stang" <ma...@earthlink.net>
To: <xi...@xml.apache.org>
Sent: Friday, July 04, 2003 4:58 PM
Subject: Re: Xpath query
> What is your command-line and os?
>
> morten svanæs wrote:
>
> > Hi,
> > I've have a webapp that use Xindice and I use xpath queries like
> > //THING[contains(FOO,'bar')]
> > This worked perfectly fine until something happend and now queries like
this
> > don't return anything !
> > Any suggestions on what I'm doing wrong ?
> >
> > Morten Svanæs
>
> --
> Mark J Stang
> System Architect
> Cybershop Systems
>
>
Re: Xpath query
Posted by "Mark J. Stang" <ma...@earthlink.net>.
What is your command-line and os?
morten svanæs wrote:
> Hi,
> I've have a webapp that use Xindice and I use xpath queries like
> //THING[contains(FOO,'bar')]
> This worked perfectly fine until something happend and now queries like this
> don't return anything !
> Any suggestions on what I'm doing wrong ?
>
> Morten Svanæs
--
Mark J Stang
System Architect
Cybershop Systems