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 Gul Akbar <G....@Bradford.ac.uk> on 2003/01/01 00:23:18 UTC

Output XML

Hello,

I have created a very simple XML Database for a Movie record. It takes the 
format:

<movie>
  <name> Some Name </name>
</movie>

In my searches, I always get some attributes in my <movie> tag, as can be seen 
below:

<movie xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/movies" 
src:key="1a071f3e00fd295b000000f25c47fdc1">
<name> Some Name </name>
</movie>

I have a few questions:

* Is it possible to retrieve results without these?

* I have noticed that the src:key has been allocated by Xindice as a unique 
identifier, is there a way to retrieve this in Java.

* How would I store the <name> as a "primary key"?

Thanking you in advance.
Gul


-------------------------------------------------
This mail sent through IMP: webmail.brad.ac.uk

Re: Output XML

Posted by Gul Akbar <G....@Bradford.ac.uk>.
Thank you Moran. That has answered my question perfectly.

Just one more thing, do you need the XPath to search the database, or could you 
use the API to get some value from an element?

Thanks

Gul

Quoting moran@server.jce.ac.il:

> The reason that Xindice has allocated a unique identifier, is that
> you probably use a null value in the following command, when
> adding a document:
> 
> XMLResource document = (XMLResource)
> col.createResource(null,"XMLResource");
> 
> where createResource is defined by the API as follows:
> _______________________________________________________________
> public Resource createResource(java.lang.String id,
>                                java.lang.String type)
> 
> Parameters:
> id - the unique id to associate with the created Resource.
> type - the Resource type to create
> _______________________________________________________________
> 
> 
> 1. What I suggest is using the name (or some other unique id) as the
> key.
> The key enables you a fast access when retrieving the documents.
> 
> 2. It is possible to retrieve using Xpath by applying a query on the
> name
> you are searching... but thats less efficient.
> 
> 3. to retrieve a document with the key simply use:
> public Resource getResource(java.lang.String id) as defined in the
> Collection API. The id in this case will be the name (or some other
> unique id).
> 
> Note that a name is not realy a unique id, but that varies in
> implementations.
> 
> Best,
> Moran.
> 
> 
> Quoting Gul Akbar <G....@Bradford.ac.uk>:
> 
> > Hello,
> > 
> > I have created a very simple XML Database for a Movie record. It takes
> the 
> > format:
> > 
> > <movie>
> >   <name> Some Name </name>
> > </movie>
> > 
> > In my searches, I always get some attributes in my <movie> tag, as can
> be
> > seen 
> > below:
> > 
> > <movie xmlns:src="http://xml.apache.org/xindice/Query"
> src:col="/db/movies"
> > 
> > src:key="1a071f3e00fd295b000000f25c47fdc1">
> > <name> Some Name </name>
> > </movie>
> > 
> > I have a few questions:
> > 
> > * Is it possible to retrieve results without these?
> > 
> > * I have noticed that the src:key has been allocated by Xindice as a
> unique
> > 
> > identifier, is there a way to retrieve this in Java.
> > 
> > * How would I store the <name> as a "primary key"?
> > 
> > Thanking you in advance.
> > Gul
> > 
> > 
> > -------------------------------------------------
> > This mail sent through IMP: webmail.brad.ac.uk
> > 
> 
> 
> 
> 
> -------------------------------------------------
> This mail sent through JCE IMP: http://portal.jce.ac.il/horde/
> Main Web Page http://www.jce.ac.il
> 






-------------------------------------------------
This mail sent through IMP: webmail.brad.ac.uk

Re: Output XML

Posted by mo...@server.jce.ac.il.
The reason that Xindice has allocated a unique identifier, is that
you probably use a null value in the following command, when
adding a document:

XMLResource document = (XMLResource) col.createResource(null,"XMLResource");

where createResource is defined by the API as follows:
_______________________________________________________________
public Resource createResource(java.lang.String id,
                               java.lang.String type)

Parameters:
id - the unique id to associate with the created Resource.
type - the Resource type to create
_______________________________________________________________


1. What I suggest is using the name (or some other unique id) as the key.
The key enables you a fast access when retrieving the documents.

2. It is possible to retrieve using Xpath by applying a query on the name
you are searching... but thats less efficient.

3. to retrieve a document with the key simply use:
public Resource getResource(java.lang.String id) as defined in the
Collection API. The id in this case will be the name (or some other unique id).

Note that a name is not realy a unique id, but that varies in implementations.

Best,
Moran.


Quoting Gul Akbar <G....@Bradford.ac.uk>:

> Hello,
> 
> I have created a very simple XML Database for a Movie record. It takes the 
> format:
> 
> <movie>
>   <name> Some Name </name>
> </movie>
> 
> In my searches, I always get some attributes in my <movie> tag, as can be
> seen 
> below:
> 
> <movie xmlns:src="http://xml.apache.org/xindice/Query" src:col="/db/movies"
> 
> src:key="1a071f3e00fd295b000000f25c47fdc1">
> <name> Some Name </name>
> </movie>
> 
> I have a few questions:
> 
> * Is it possible to retrieve results without these?
> 
> * I have noticed that the src:key has been allocated by Xindice as a unique
> 
> identifier, is there a way to retrieve this in Java.
> 
> * How would I store the <name> as a "primary key"?
> 
> Thanking you in advance.
> Gul
> 
> 
> -------------------------------------------------
> This mail sent through IMP: webmail.brad.ac.uk
> 




-------------------------------------------------
This mail sent through JCE IMP: http://portal.jce.ac.il/horde/
Main Web Page http://www.jce.ac.il