Castor parsing

M

mikew01

Hi,

Im looking for some assistance with how Castor marshalls/unmarshalls
objects.

Ive written an app that uses triple DES encryption/decryption which
works fine when applied to JUnit test data but when I make use of
castor to send the xml data across a network at some point control
characters are being inserted into the encrypted data which of course
causes the decryption to fail. I have resolved the problem by
stripping out whitespace from the string before decryption but this is
not ideal, hence my question regarding Castor.

The app works fine so long as the string is less than 55 characters,
one char above and the control character is inserted and the app
fails.

I am using
org.exolab.castor.parser=org.apache.xerces.parsers.SAXParser in the
castor.properties file for parsing the xml

Any help would be appreciated.

TIA
 
M

mikew01

Just to add to the above, the data I am trying to parse is between a
set of tags, not the whole xml file.
 
O

Oliver Wong

mikew01 said:
Hi,

Im looking for some assistance with how Castor marshalls/unmarshalls
objects.

Ive written an app that uses triple DES encryption/decryption which
works fine when applied to JUnit test data but when I make use of
castor to send the xml data across a network at some point control
characters are being inserted into the encrypted data which of course
causes the decryption to fail. I have resolved the problem by
stripping out whitespace from the string before decryption but this is
not ideal, hence my question regarding Castor.

The app works fine so long as the string is less than 55 characters,
one char above and the control character is inserted and the app
fails.

I am using
org.exolab.castor.parser=org.apache.xerces.parsers.SAXParser in the
castor.properties file for parsing the xml

Any help would be appreciated.

I think we need a bit more detail. For example, here's my guess at
what's going on in your situation. Can you say whether this guess is
correct, and if not, what's wrong with it?

You have some input string "Hello World".
You encrypt it, to get some encrypted String "ABCDEFG".
You use Castor to unmarshall it into an XML document, "<xml>ABCDEFG</xml>"
If you just process the XML document locally, you can successfully extract
the encrypted string, and decrypt it.
If you try to send the XML document over the network, some mysterious
control characters, in the form of whitespace, appear, "<xml>ABCDEFG
</xml>", and you have to do some whitespace trimming to fix things.

Is this correct?

- Oliver
 
M

mikew01

Yes, Ive found out what Castor does now by capturing its output before
and after, the examples below show the results.
A string longer than 55 chars is carriage returned
, apparently
this option is configurable to turn on off but I think Ill stick with
my first approach to trim whitespace before decrypting.

Thanks.

g74gqWaH7aIoQ88XEl//r/
GZHnnoL0VRVsgLyTMN7xHzJtWAUdfP05oQ2EYYuPYVXzK2h8GbZM5S
2Qy5K0kso
+0RICTRka6ypLfTV9s6H7goSZnLYMXHh0Vsyw2HH1A8ZU1WBckSqntNEIyRqSPm7TYk
98ByM9+fG1l0+kDn4OFwZCSebJQMaGLpkenryfV0AyKFTKDwfX9cD3gd10nGy3zZGwSmQleBZEAJ
JTTtyfqjAwEuIr6xkRYbyiAHiq2l6uz+V1F8H2uNbbgfy0QuYj40F3nIVMxUVHUu/
WaIOD45Otvt
3Ts7nCJtJSCznd2oNHhT8AHZ1Ylk4NRCt5gAxPJ1KR98oYsN3wSVXi3vXH6QDmKBG
+HJCpAti2g/
TXIFYOfA4m3YRZc7ygzqvMUgApNuHZt/mafqXJDT9aIy8mD48383kR2YdHoCRCAzGOTk



g74gqWaH7aIoQ88XEl//r/
GZHnnoL0VRVsgLyTMN7xHzJtWAUdfP05oQ2EYYuPYVXzK2h8GbZM5S
2Qy5K0kso
+0RICTRka6ypLfTV9s6H7goSZnLYMXHh0Vsyw2HH1A8ZU1WBckSqntNEIyRqSPm7TYk
98ByM9+fG1l0+kDn4OFwZCSebJQMaGLpkenryfV0AyKFTKDwfX9cD3gd10nGy3zZGwSmQleBZEAJ
JTTtyfqjAwEuIr6xkRYbyiAHiq2l6uz+V1F8H2uNbbgfy0QuYj40F3nIVMxUVHUu/
WaIOD45Otvt
3Ts7nCJtJSCznd2oNHhT8AHZ1Ylk4NRCt5gAxPJ1KR98oYsN3wSVXi3vXH6QDmKBG
+HJCpAti2g/
TXIFYOfA4m3YRZc7ygzqvMUgApNuHZt/mafqXJDT9aIy8mD48383kR2YdHoCRCAzGOTk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top