Right, importing it and appending it are two different things.  So it seems
like a new requirement is that the content has to be part of the document
first.  I'm guessing it's related to the ID bug; I believe an xml:id has to
be unique within the entire document.  My example is culled from a utility
class I was using that was supposed to take content and return signed
content.  I can't sign content unless it's already in a document.  I think
I can work with this and the reason now makes sense.

Thanks for the guidance,

Michael Bishop

On Mon, Aug 20, 2012 at 5:55 PM, Cantor, Scott <[email protected]> wrote:

> On 8/20/12 5:47 PM, "Michael Bishop" <[email protected]> wrote:
> >
> >This may be significant.  When I'm trying to sign an entire document,
> >here's what I do:
> >
> >Document signedDoc = // This is a new empty document.
> >
> >// Import the document I want to sign into my new document.
> >final Node content = signedDoc.importNode(oldDoc.getDocumentElement(),
> >true);
> >
> >// In here, I actually sign the content.
> >final Node signedContent = ApacheSantuario.sign(content);
>
> That probably won't work. After import, signedDoc.getDocumentElement() is
> either null, or at minimum isn't connected to the imported tree, which
> means searching that document for an ID will fail.
>
> -- Scott
>
>

Reply via email to