Re: [bdbxml] Namespaces in metadata

George Feinberg <[email protected]>
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
Mike,

I did not run the Perl script you sent, but the following is a small
script that can be run in the dbxml shell that does what you
are talking about, and works.  It just verifies that you can
query for user-defined metadata.  You might check to be sure
there is not another error in your Perl script or original
XQuery expression.

You can run this by saving it to a file, and running
     dbxml -s <filename>
or run it directly from the shell using the "run" subcommand.


createContainer ""
putDocument foo <root/>
setMetaData foo X A string a
setMetaData foo Y B string b
setNamespace x X
setNamespace y Y
query "for $doc in collection('')
       return dbxml:metadata('dbxml:name',$doc)"
print
query "for $doc in collection('')
       return dbxml:metadata('x:A',$doc)"
print
query "for $doc in collection('')
       return dbxml:metadata('y:B',$doc)"
print


George

On Jun 15, 2005, at 8:37 PM, Mike Trotman wrote:

> I am using the Perl interface to DbXML.
>
> I can retrieve document metadata in specific namespaces OK using
> getMetaData('URI','attName',$value);
>
> BUT
>
> when I try this in XQuery - it only seems to work for the dbxml
> namespace.
>
> Below is an example program that demonstrates this not working.
> Apologies for the length - it was the shortest self-contained  
> example I
> could come up with that worked.
> In the script I create a simple document,
> then
> setMetaData('X','A','a');
> setMetaData('Y','B','b');
>
> but when I use the following context:
>
> $context = $mgr->createQueryContext();
> $context->setNamespace('x'     => 'X');
> $context->setNamespace('y'     => 'Y');
>
> and try to retrieve values in XQuery
>
> let $XA := dbxml:metadata("x:A",$doc/*[1])
> let $n := dbxml:metadata("dbxml:name",$doc)
> let $YB := dbxml:metadata("y:B",$doc)
>
> only the document name in $n has content;
>
> There may well be something stupid I am doing - so any help would be
> greatly appreciated.
>


------------------------------------------
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.