Re: [bdbxml] How retrieve metadata onto a document?

George Feinberg <[email protected]> Sun, 11 Sep 2005 22:08:28 -0400
Newsgroups gmane.comp.db.dbxml.general
Message-ID <[email protected]>
Ambar,

You have run across a bug that has recently come to light,
specific to the Java interface.

The XmlDocument.getMetaData() interfaces do not properly
work with binary data.  It is not yet clear if there is a
simple fix for this problem that can be patched in 2.1.8.
It is under investigation.

A workaround is to use the String type for metadata (rather
than byte[]) if you can perform the mapping safely.

Please watch this list for information.

Regards,

George


> Hi all ...
>
> My application set metadata by:
>
> String URI = "http://dbxmlExamples/metadata";
> byte[] img = {1,2,3,4,5,6,7,8};
> String attrName = "byteArray";
> XmlUpdateContext contextManagement = myManager.createUpdateContext();
> XmlDocument myDoc = myManager.createDocument();
> myDoc.setName("doc");
> myDoc.setContent("<example>doc</example>");
> myDoc.setMetaData(URI,attrName,img);
> myContainer.putDocument(myDoc,contextManagement,0);
>
> And retrieve by:
>
> XmlQueryContext context = myManager.createQueryContext();
> context.setNamespace("mn","http://dbxmlExamples/metadata");
>
> String query = "collection('exmples.bdbxml')/example";
> XmlQueryExpression qe = myManager.prepare(query,context);
> XmlResults results = myManager.query(query,context);
> XmlValue value = results.next();
>   if(value != null){
>     XmlDocument theDoc = value.asDocument();
>     String docName = theDoc.getName();
>     byte[] byteArray= null;
>     theDoc.getMetaData("http://dbxmlExamples/ 
> metadata","byteArray",byteArray));
>   }
>
> But byteArray continue null. Also, test with:
> 1. String query = "collection('images.bdbxml')/@dbxml:byteArray";
> 2. XmlMetaDataIterator
>
> I don't know, what's wrong?
>
> Any help would be appreciated.



------------------------------------------
To remove yourself from this list, send an
email to [email protected]