The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

powerfu (6) [Avatar] Offline
2 white spaces after >
For some reasons, the server always reads 2 white spaces after the character, >.

That is, if I pass the string, <message from="xxx" to="yyy"><body>hi</body></message>

The server will read, <message from="xxx" to="yyy"> <body> hi</body> </message>

There is no problem for regular use. However, I modified the client and server to sign all messages, and those white spaces would mess up the signature.

I look into code and couldn't find where the problem is.

Please advise.
iain (56) [Avatar] Offline
Re: 2 white spaces after &gt;

In general, the XML parser/generator being used does not attempt to preserve whitespace. This means, the server will save the XML content, but the whitespace between elements, etc can and will change when going through the server. This is quite common in XMPP/Jabber systems. In fact, you'll often receive XML and the attributes are in different orders than what was sent, additional data inserted or extraneous info removed.

For security, there are a few ways better ways to attack the problem. First, you can use an SSL connection between clients and servers to prevent snooping. If you're worried about the server snooping on messages, you can encode/sign/encrypt just the message body using standard ciphers. There are several standards under development to formalize a common means of doing this. See the JEPs (Jabber Enhancement Proposals) at

Hope this helps