[xml] XML Parser with *stealing behaviour*



Dear all,
I'm facing with a quite strange problem regarding the parser.

I've to access a service that publishes assertions regarding users in
SIGNED XML files. For example, if I point my application to

http://192.168.0.3:6589/?ID=1234

I receive a signed xml file with some informations.

My application access quite often to this service. The first time I
access and receive xml there are no problems :

1)  doc = xmlReadFile(xml_file, NULL, 0); ok, doc is not NULL and if I
do an xmlDocDump(stdout, doc); I can see the perfect replication of the
file downloaded.
2) the verification of sign ends succefully.

The second time :

1) I access to another file but the verification of sign fails.

The problem regards the setup of doc structure :

1) doc = xmlReadFile(xml_file, NULL, 0);
2) xmlDocDump(stdout, doc); Now I can see my xml all to a SINGLE
LINE !!! As if the parser decides to _steal_ all '\n'.

From the service I receive the XML in a correct way (checking byte per
byte). I've also tryed to save the stream received from service and save
all in string null-point terminated and then trying

doc=xmlParseMemory(chunck.memory,chunck.size);

but domping it xmlDocDump(stdout, doc) I obtain always the XML in a
single line without my '\n'.

Obviously, before any access to the server, I call a deinitEnv function
that clean everithing from the doc to the parser.

These '\n' are important for sign verify because with an XML like
<Signature
xmlns="http://www.w3.org/2000/09/xmldsig#";><SignedInfo><CanonicalizationMethod 
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><SignatureMethod 
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>

...

the process fails because it want somethin like

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#";>
<SignedInfo>
<CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>

with no exception to reach correctly every node.


Does anybody have an idea where my '\n's are ?
Thanks,
Flt



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]