You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeong Ahn Lee <je...@yahoo.com> on 2002/06/24 08:21:26 UTC

Serialization problem!!

Hi all,

i am having a problem in serializing and
de-serializing the XML (Dom document)

what i am doing is i am creating a
org.w3c.dom.Document object ( SOAP Message)
i am digitally signing it using XML security suite
from apache( Digial Signature),

i am serializing it like below

// org.apache.xml.serialize.XMLSerializer;

XMLSerializer serializer = new XMLSerializer();
String docString = serializer.writeToString(doc);


and de-serializing it like below

DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(new
StringReader(docString)));


but what happens is in these processes(serializiation
and de-serialization) the document
get modified and my signature verification fails.

what should i do to avoid this. what i am doing is
correct?

for me serializiation and de-serialization is very
important because, i need to send that
document over HTTP.

Thanks in advance
Jeong Ahn

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: Serialization problem!!

Posted by Elena Litani <el...@ca.ibm.com>.
Jeong Ahn Lee wrote:
> i am serializing it like below
> 
> // org.apache.xml.serialize.XMLSerializer;
> 
> XMLSerializer serializer = new XMLSerializer();
> String docString = serializer.writeToString(doc);

I assume you are using Xerces 2.0.1? writeToString used to preform the
automatic namespace fixup and it might be causing your document to be
modified.

Try Xerces 2.0.2 and use method serializer.serialize( doc ) instead.
Please,let us know if your document gets modified anyway.

Thanks!
-- 
Elena Litani / IBM Toronto

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org