Bon Soir, Axelle, First of all don´t use crimson as XML parser it can you give some head aches. Anyway, your problem can be fix by using doc.importNode function. But I don't understand your intends.
Regards, Raul http://r-bg.com On Tue, 1 Feb 2005 17:33:53 +0100 (CET), def abc <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm trying to build an enveloping signature: > - the input is a Document. I want to sign this. > - the output is a FileOutputStream. I want to write > the enveloping signature in this file. > > But it doesn't work: I get a > "org.apache.crimson.tree.DomEx: WRONG_DOCUMENT_ERR : > Ce noeud n''appartient pas à ce document." (this node > does not belong to this document) from the first > appendChild. > > I do understand the error (obj is built from Document > input but we append it in Document doc)... but not the > way to resolve this. > > Thanks for any help, > > Axelle. > > // create the ds:Object > Document doc = db.newDocument(); > ObjectContainer obj = new ObjectContainer(input); > doc.appendChild(obj.getElement()); > > // sign the object > XMLSignature signature; > signature = new XMLSignature(doc, > outputURI.toString(), > XMLSignature.ALGO_ID_SIGNATURE_RSA_SHA1); > signature.addDocument(inputURI.toString()); > signature.appendObject(obj); > signature.sign(prvkey); > > // output result to file > doc.appendChild(signature.getElement()); > XMLUtils.outputDOM(doc, output); > > Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails > ! > Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/ >