Three Types of XML Signature:
The W3C recommendation allows any digital data to be signed, and this includes an XML document, an XML element of a document, and the content of an XML element as particular cases.
When we talk about an XML signature, we are actually referring to an XML document, which contains the Signature (defined in the namespace http://www.w3.org/2000/09/XMLdsig#) as one element (which may be the root element). But the document may also contain other elements, among which the most important are, of course, the original data objects being signed.
Depending on how those data objects relate to the Signature element in an XML Signature document, we consider three different types of XML signatures.
Enveloping: The data objects are contained within the same XML document as the Signature element, and are further included in the Signature element (as sub-elements of Object, for example).
Enveloped: The data object is found within the same XML document as the Signature element, and actually includes the Signature as a sub-element.
Detached: The Signature refers to external network resources, or the data object is within the same XML document as the Signature element, but is a sibling element, or is a sub-element of its sibling element.
Some writings on XML Signature leave readers the impression that this is an exclusive classification of XML signatures; others implicitly suggest that, in enveloping or enveloped signatures, there is actually an Envelop element in the XML document containing the signature; and still others imply that for an enveloping signature, Signature is the root element of the XML document. These are all plainly wrong.
Data Integrity and Message Authentication
The main purpose of XML digital signature is to ensure the integrity of data. RFC 2828, Internet Security Glossary, defines integrity as “the property that data has not been changed, destroyed, or lost in an unauthorized or accidental manner.” Storing or transiting the data together with a checksum can achieve data integrity in this sense. Strictly speaking, XML Signature ensures more than such integrity. It provides support for what RFC 2828 refers to as message authentication, the property “given an authentication code/protected checksum, that tampering with both the data and checksum, so as to introduce changes while seemingly preserving integrity, are still detected.”
source:http://today.java.net/pub/a/today/2006/11/21/xml-signature-with-jsr-105.html

