Storing and retrieving non-xml data

Hi there,

I’ve been storing some jpg files in Tamino. How do I retrieve these files if I don’t have the whole document name? Let’s say the document names are Smith001.jpg and Smith002.jpg etc. Can I do a query or something to determine all the documents starting with Smith*?

Even if I can’t do that, surely there must be a way of accessing all the data in the database without knowing the document names.

Hello Jean,

I have the following non-xml documents in my ino:etc collection:

   <ino:nonXML ino:id="1" /> 
   <ino:nonXML ino:id="2" /> 
   <ino:nonXML ino:id="3" /> 
   <ino:nonXML ino:id="4" />
   <ino:nonXML ino:docname="dtp_xmen_02.jpg" ino:id="5" />
   <ino:nonXML ino:docname="dtp_xmen_03.jpg" ino:id="6" /></pre><BR>As you can see, they are all of type "ino:nonXML", but they do not all have ino:docnames.<BR>To find those which have ino:docnames starting with "dtp" this query could be used:<BR><pre class="ip-ubbcode-code-pre">   /ino:nonXML[@ino:docname~="dtp*"]</pre><BR>Those without ino:docname attributes can be retrieved via their ino:id, like this:<BR><pre class="ip-ubbcode-code-pre">   http://localhost/tamino/test/ino:etc/ino:nonXML/@1

I hope that helps,

Thanks for the advice Trevor but I don’t really understand how you do that.

How exactly do you do this query? I’ve tried but have been unable to do it. Perhaps the fact that you are using the ino:etc collection is confusing me, I don’t know if I’m supposed to use ino: or not.

I stored the non-xml with the non-xml activex api and there is no xquery function. I tried with the xquery tool but no results either.

Could you please explain as simple as possible.

Hello Jean,

after I had posted a dissertation on the storage and retrieval of nonXML documents in Tamino, I read through the whole thread again and came to the conclusion that I had misunderstood your problem! So I decided to delete said dissertation and ask a few clarifying questions…

Is it correct to think that you have successfully defined a nonXML schema, inserted documents into it and can retrieve them with queries executed via the browser?
Like this:

   http://<hostname>/tamino/<DB name>/<Collection name>?_xql=/<doctype name></pre><BR>Is it also correct to say that the problem now is how to retrieve <B>a set</B> of nonXML documents - rather than one specific document - via the ActiveX API?<BR><BR>If this is the case, I think that you should use a combination of the XML and nonXML controls from the ActiveX API.<BR><BR>Use the XML control (TaminoX.TaminoX1) to execute a query which identifies the nonXML documents, then iterate through the XML results and feed the ino:docname into the nonXML control (TaminoNonXml.TaminoNonXmlCtrl1) to retrieve the nonXML content.<BR><BR>When I execute the query from my previous post in a browser, I get this result:<BR><pre class="ip-ubbcode-code-pre">   <?xml version="1.0" encoding="ISO-8859-1" ?> 
   <ino:response xmlns:ino=""
      <ino:message ino:returnvalue="0">
         <ino:messageline>XQL Request processing</ino:messageline> 
         <ino:nonXML ino:docname="dtp_xmen_02.jpg" ino:id="5" /> 
         <ino:nonXML ino:docname="dtp_xmen_03.jpg" ino:id="6" /> 
      <ino:message ino:returnvalue="0">
         <ino:messageline>XQL Request processed</ino:messageline> 

The result of this query is XML (perhaps you could say that it is the metadata for the nonXML documents) and so should be fine to process with the XML control.

If the problems are with the ActiveX API (rather than with the schema or the queries) it is probably better to post to the ActiveX API Forum.

I hope that helps,

Hello Trevor,

I think we were just talking past each other a bit. I have only used xquery and was trying to do the search using it, I didn’t realise you were using x-query.

I have been unable to get xquery to return any result for non-xml but I have now been able to get your solution to work. My main problem was getting to the data in my non-xml store without storing the docnames somewhere else.

I’ve also been a bit unsure of the best way of working with non-xml data (i.e. using the xml api to search and the non-xml api to retrieve).

Do you perhaps know if the same is possible by using xquery?

Thanks for all your help

Hello Jean,

I’m sorry but I don’t think that this is possible via XQuery.

I tried to do an XQuery to retrieve the ino:docname attributes for the nonXML documents in my database, but I suspect the results are the same as those you have already seen:

   declare namespace ino=""
   for $a in input()/ino:nonXML
   return $a/@ino:docname
</pre><BR>The result of this query is a fairly explicit error message:<BR><pre class="ip-ubbcode-code-pre">   ino:code="INOXQE6364"
   <ino:message>XQuery Applied on non-XML Doctype: ino:nonXML</ino:message>
</pre><BR>The documentation for this error message is also pretty straightforward:<BR><pre class="ip-ubbcode-code-pre">   INOXQE6364
   XQuery applied on non-XML doctype: 

       XQuery is only applicable to XML data.

       Use another tool for querying.

I don’t think that this is a big drawback though, as the XML metadata Tamino maintains for a nonXML document is only the ino:id and ino:docname attributes.

Perhaps you could use a different approach: embed the nonXML data into an XML document using a CDATA section?
You would need to do some extra work to encode the binary data for storage, and then convert it back after retrieval (i.e. using the MIME type), but this approach would allow you to store more “metadata” in the XML part of the document

This is just an idea though - I have not convinced myself that this approach has any advantage over using an XML document and referencing a nonXML document from it.

Hopefully someone with some real experience of storing nonXML will post a reply to your request for such experiences.