JAXB + XML Digital Signatures
I have a schema defined by a government agency, which defines a standard for a certain type of document. Such documents require an XML digital signature, and the schema references the W3C Digital Signature schema. The signature is mandatory element of the schema.
My problem is that when I build up the document, using the JAXB Java objects, I then need to marshal these objects to an DOM, so that my signing utility can sign the document and add in the Digital Signature.
However, when marshalling to a DOM, I get a validation error because at this point I do not yet have the signature element. What I did as a work around was to make the signature element optional, but I would rather not have to modify the schemas, since they are not under our control.
Is there at this moment any way to sign a JAXB object and embed in the signature element?
If not, is there anything that I can put in the binding file (I use an external binding file) that can stop the validation of this element, or indeed validation of any elements?
Otherwise, if anyone has any good suggestions as to how to approach this, it would be really appreciated.
Thanks in advance for you help, Jonathan.