Our prospect is asking us about the Native XML Storage. If he stores a XML document in Tamino(with schema), is it possible to recover “exactly the same” XML document from Tamino?, for example:
When he reads this XML using X-Plorer and save that to a file, Tamino returns:
Although I told him the XML specification doesn’t say anything about the attributes position I couldn’t convince him.
His question is: Why Tamino change the attribute positions?
Thanks and Regards,
I have also experienced this as well. I have no idea why attribute order is [sometimes] changed, but it really shouldn’t matter. Have a look at section 3.2 in http://www.w3.org/TR/xpath-datamodel/#document-order . It specifies in the fifth bullet item that “The relative order of attribute nodes is stable but implementation-dependent”.
Hope this helps.
Software AG (UK) Ltd.
Tamino will return “exactly the same XML document” that was stored, subject to an understanding of what it means for two XML documents to be exactly the same. This isn’t based on binary equivalence (encoding isn’t considered significant) or even on character equivalence (the difference between " and ’ around attribute values is not considered significant). Rather, it is based on equivalence at the level of the data model. Attribute order is not considered significant in the data model, and therefore there is no guarantee that it is retained. In general, the data model defines what information in an XML document is significant and what isn’t, and applications shouldn’t rely on things that aren’t significant (such as encoding, choice of attribute delimiters, or attribute order).
Answering Stuart’s comment about attribute order, I think that some XML parsers store attributes in a hash table for efficient lookup. Hash tables retain the names and values of the attributes, but not their original order. This is an example of the kind of optimization that is made possible because the data model carefully defines what is significant and what isn’t.
Tamino will return “exactly the same XML document” that was stored , but it isn’t literally truth.
How Can I generate digital signature from XML document, storaged in Tamino, retrieve it and validate this digital signature if the document XML not is the same?
Digital signature is not applicable if using Tamino.
PD: I can’t use XML Digital Signature because the signature must be generate in Client Browser with a cryptographic smart card.
because the XML standard does not demand that the attributes of an XML element have to be in a particular order, you can not depend on the order of attributes does not change (independent if the document has been stored in Tamino or not).
However, in case of XML Signature this problem has been solved by transforming the document into a canonical form. The canonical form does not change, independent if a document is stored, transmitted, parsed,… etc.
If you don’t use XML Signatures but still like to sign an XML document, you have to do the same by yourself, transform the document into its canonical form and sign the canonical form of the document.
But you have not to pass on XML Signature because of the usage of Smart Cards. E.g. the Apache XML Security project provides a C API, supporting e.g. the Microsoft CAPI. Additonally, with JDK 1.5 (available as alpha version) PKCS#11 support is provided, which currently also is added to the Apache XML Security Java API.
Hope it helps,
Software AG R&D