Hi,
I am working in a socket application where I am sending the data to the server in xml form and receiving reesponse for it in an xml format. The problem is that when I am trying to parse the message I am getting the error that it cannot parse the xml.
I am using the API
QDomDocument setContent(byteArray);
in the byteArray there is a message in xml format from the server. When I debugged the API I found that the error was because of the comment format in the server response.
The server response was
Now the comment understood by QDomComment is in the form ofQt Code:
<?xml version="1.0" encoding="UTF-8"?> <!--- TCP probe server response v0.121 ---> <probeResponse version="1.0" xmlns="https://www.xxxx.com/schemas/probe/v1_0"> <params> <period>45</period> <next>90</next> <dec>0.71</dec> <valid>604800</valid> <count>10</count> </params> <detect> <xaddress>0x0a24654e</xaddress> <xport>0x068c</xport> </detect> <timestamp>44675436</timestamp> <nonce>JwMFecnLFUz/REJ8HuQE45943</nonce> <signature method="HMAC-SHA1">ZajDI9xJLFfP3B8UFSVCmk9oyLY=</signature> </probeResponse>To copy to clipboard, switch view to plain text mode
<!-- XXXXX -->
Since the server response is having the comment as <!--- XXXX --->
an extra "-" so it is giving error there. When I try to write the response in file and manually remove the "-" from comment and then try to use setContent() it works like charm.
Please help me is there any way I can define the rule to accept such comment as valid comment because the server implementation cant be changed I have to have some kind of work around to make this accept as valid xml message.
Regards,
Yogesh
Bookmarks