You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Andrzej Matejko <an...@pro.onet.pl> on 2003/12/04 11:03:06 UTC

DOMWriterImpl - how to serialize (write into memory buffer) xml document

Hi,

   I need to serialize my signed xml document into string. And the 
problem is: when I serialize xml document DOMWriteImpl reorder (sorts in 
alphabetic order) attributes in each node , change < and &, :(..
   My samlpe code (based on apache.org) looks like:

------------------------------begin---------------------------------
XMLCh tempStr[100];
XMLString::transcode("LS", tempStr, 99);
DOMImplementation *impl 
=DOMImplementationRegistry::getDOMImplementation(tempStr);
DOMWriter *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();

DOMPrintFilter *myFilter=0;
// set user specified end of line sequence and output encoding
theSerializer->setNewLine(gMyEOLSequence);
theSerializer->setEncoding(gOutputEncoding);

XMLFormatTarget *myFormTarget;
myFormTarget = new MemBufFormatTarget(50000);

theSerializer->writeNode(myFormTarget, *doc);

XMLByte *buf;
unsigned int uiBufLen = ((MemBufFormatTarget*)myFormTarget)->getLen();

const XMLByte* pcBuf;
pcBuf = ((MemBufFormatTarget*)myFormTarget)->getRawBuffer();

-------------------------------end---------------------------------

   And the question is: how to serialize xml document in such way, that 
it isn't sorted, characters like '<', '&' are not changed into &gt; ?
   Why is it so important? because I have created digital signature over 
this document before serialization and after DOMWriterImpl 
'reorder-work' signature is broken.


    looking for your help,
      best regards,
        andrew



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