Re: [bdbxml] namespace problem

John Snelson <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
sarigiannis xaralampos wrote:
> Thanks George for the answer indeed I instantiate a single XmlManager 
> object, and keep it around for
> 
> the lifetime of my application  but I don t do the same with the 
> XmlQueryExpression .
> 
> You mean to create once an XmlQueryExpression lalas= new 
> XmlQueryExpression();  and use this variable whenever i need to make a 
> query instead of initializing new XmlQueryExpression variables all the 
> times you need to make a query?? (indeed XMLDB objects are very heavy it 
> s good as I realised everytime I create sth like XmlQueryExpression to 
> delete them  )

You can do that, but it won't gain you very much. What my colleague 
meant was that if you were going to run the same query a number of times 
(even in a number of different threads), you could do this by 
pre-parsing the query to an XmlQueryExpression object, and calling 
XmlQueryExpression::execute() many times over.

If you do this from different threads, you will need to use an 
XmlQueryContext for each thread, as these cannot be shared across threads.

> Anyway
> 
> I have one problem when using the below type of namespace :
> 
> <assessmentItem xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0"
> 
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 
>    xsi:schemaLocation=" http://www.imsglobal.org/xsd/imsqti_v2p0 
> imsqti_v2p0.xsd 
> <http://www.imsglobal.org/xsd/imsqti_v2p0%20imsqti_v2p0.xsd> 
> "title="Unattended Luggage" >
> 
>  
> 
> in order I make xqueries I instantiate an Xmlquerycontext
> 
>  
> 
>  context.setNamespace(" ", "http://www.imsglobal.org/xsd/imsqti_v2p0");

This is not allowed. I believe what you are trying to do is to set the 
default element namespace for the query - but BDB XML does not currently 
provide a way for users to do this. Instead, you will need to bind a 
prefix to the namespace like this:

context.setNamespace("ims", "http://www.imsglobal.org/xsd/imsqti_v2p0");

And use the prefix in you query, ie:

/ims:assessmentItem

/ims:assessmentItem[@title='Unattended Luggage']

> when my query has the form for instance   / assessmentItem  it does work
> 
> when my query has the form for instance   / assessmentItem/[@title=’ 
> Unattended Luggage’]  it does  not work :((

I hope this helps,

John Snelson

-- 
John Snelson, Berkeley DB XML Engineer
Sleepycat Software, Inc
http://www.sleepycat.com

Contracted to Sleepycat through Parthenon Computing Ltd
http://blog.parthcomp.com/dbxml


------------------------------------------
To remove yourself from this list, send an
email to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.