Hi there,
I have posted the question in another forum before but no one in that forum seems to be able to give a reply so this seems to be the next best appropriate place to look for answers. I there is anyone who can help me out here, I would like to know if binary objects such as images are stored in its true binary format in Tamino. or does the image need to go thru some encoding. I am asking this more for the sake of getting some concepts clear. currently i am using mainly xschema and a touch of tamino tags and i know xschema allows me to store binary objects (eg,images) but they have to be encoded first using base64 encoding. now the thing is xml documents are mainly text isn’t it? so in order for a binary object to be stored as xml, it has to be encoded in some way to be in text form to be stored, which in the case of xschema, using base64 encoding to change it to its hex equivalant in text form. Please correct me if I am wrong on this. now, i also know that tamino stores binary objects using this below(just a snippet of schema)
<tsd:doctype name = “CarImage”>
tsd:nonXML</tsd:nonXML>
</tsd:doctype>
so my question is : does tamino store the binary object in its true native form or is there some underlying encoding and decoding going on during storing and retrieval?
Now I also have another burning question: Can tamino store both xml and non xml data in the same schema. I have the sneaky feeling that it is possible but the reason why I am asking this is becos when I look at the java API used to retrieve out the information such as below (snippet of code)
TXMLObjectAccessor xmlaccess=conn.newXMLObjectAccessor(…)
TXMLObject xmlobject=xmlaccess.query(…)
TNonXmlObjectAccessor nonxmlaccess=conn.newNonXMLObjectAccessor(…)
TNonXmlObject nonxmlobject=nonxmlaccess.query(…)
As you can see from the above code, the API has strictly separated for accessing the non xml data and the xml data. so the thing is , how can i combine non xml data and xml data together in the same schema using xschema or tsd or both and retrieve all these information thru the API?
I hope someone can give me a clear answer here cos these questions have been bothering me for some time now. Any help or direction rendered would be greatly appreciated. Thanks in advance!!
Yes, Tamino can define both XML and Non-XML doctypes within the same schema. Simply define two (or more) tsd:doctypes within your tsd:schemaInfo (if you’re writing the code manually, otherwise you can just create two root doctypes in the schema), and define one of them as xml, and one as non-xml. For example:
<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema
xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition"
xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:appinfo>
<tsd:schemaInfo name = "my-xml-and-nonxml-schema">
<tsd:collection name = "mycollection"></tsd:collection>
<tsd:doctype name = "xml-document">
<tsd:logical>
<tsd:content>closed</tsd:content>
</tsd:logical>
</tsd:doctype>
<tsd:doctype name = "nonxml-document">
<tsd:nonXML>
<tsd:index>
<tsd:text></tsd:text>
</tsd:index>
</tsd:nonXML>
</tsd:doctype>
<tsd:adminInfo>
<tsd:server>4.1.4.1</tsd:server>
<tsd:modified>2003-10-13T11:47:37.068-05:00</tsd:modified>
<tsd:created>2003-10-13T11:47:37.068-05:00</tsd:created>
<tsd:version>TSD4</tsd:version>
</tsd:adminInfo>
</tsd:schemaInfo>
</xs:appinfo>
</xs:annotation>
<xs:element name = "xml-document" type="xs:string">
<!-- put the nitty-gritty details here -->
</xs:element>
</xs:schema></pre><BR><BR>As for accessing both in java, the xml and nonxml object accessors act independently of each other. If you use the TXMLObjectAccessor to run a query on "/xml-document[@ino:id=5]", you'll be able to access that xml-document through the response. Similarly, if you use the TNonXMLObjectAccessor to run a query on "/nonxml-document[@ino:id>2]", you'll be able to access those nonxml-documents through <I>that</I> response.<BR><BR>I'm not sure what happens if you, for example, do a search that comes up with xml documents when you're using a TNonXMLObjectAccessor. I'd guess that you just aren't able to retrieve any documents through the accessor, but someone correct me if I'm wrong.<BR><BR>I'm not sure about the native storage format for Non-XML documents. Perhaps someone with a little more experience than myself will be able to answer that.<BR><BR>I hope this helps.<BR><BR><BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by macy:<BR>Can tamino store both xml and non xml data in the same schema. I have the sneaky feeling that it is possible but the reason why I am asking this is becos when I look at the java api used to retrieve out the information such as below (snippet of code)<BR><BR><pre class="ip-ubbcode-code-pre">TXMLObjectAccessor xmlaccess=conn.newXMLObjectAccessor(..)
TXMLObject xmlobject=xmlaccess.query(..)
TNonXmlObjectAccessor nonxmlaccess=conn.newNonXMLObjectAccessor(..)
TNonXmlObject nonxmlobject=nonxmlaccess.query(..)
As you can see from the above code, the API has strictly separated for accessing the non xml data and the xml data. so the thing is , how can i combine non xml data and xml data together in the same schema using xschema or tsd or both and retrieve all these information thru the API?
Hi,
Just a few comments:
1) It is possible to have a single schema that defines a doctype for nonxml and well as xml. However these are still two different document types. So in the example schema supplied by Pierce one can store XML documents with the root element xml-document, and non xml binary data againest the nonxml-document doctype.
2) In terms of storage of nonxml data, the data is stored “as is”. The mapping type tsd:nonXML means the underlying storage is for blobs and not xml. So the binary data is not encoded as base64.
3) If you want to store an xml document with embedded binary data then the binary portion would need to be encoded so that it does not break the XML. In this case base64 encoding is ideal. For this you define a schema for the XML as normal. You would have an element in the schema that will contain xs:string. The binary data would have to be encoded using base64 encoding programmatically.
4) In terms of “querying” nonxml data, you can only query using X-Query (not XQuery) and the only information you get back is the ino:id and the ino:docname. If you need more information like meta-data then the Tamino NonXML indexer would be beneficial - but obviously this is only capable of indexing a selection of different binary formats.
Hope this helps.
Stuart Fyffe-Collins
Software AG (UK) Ltd.