|
|
Castor parsing
Hi,Im looking for some assistance with how Castor marshalls/unmarshallsobjects.Ive written an app that uses triple DES encryption/decryption whichworks fine when applied to JUnit test data but when I make use ofcastor to send the xml data across a network at some point controlcharacters are being inserted into the encrypted data which of coursecauses the decryption to fail. I have resolved the problem bystripping out whitespace from the string before decryption but this isnot 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 appfails.I am usingorg.exolab.castor.parser=org.apache.xerces.parsers.SAXParser in thecastor.properties file for parsing the xmlAny help would be appreciated.TIA
|
|
0
|
|
|
|
Reply
|
mikew01
|
3/20/2007 9:46:59 AM |
|
Just to add to the above, the data I am trying to parse is between aset of tags, not the whole xml file.
|
|
0
|
|
|
|
Reply
|
mikew01
|
3/20/2007 9:54:53 AM
|
|
"mikew01" <mikew01@blueyonder.co.uk> wrote in message
news:1174384019.895686.276180@n76g2000hsh.googlegroups.com...
> 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
|
|
0
|
|
|
|
Reply
|
Oliver
|
3/20/2007 4:19:41 PM
|
|
Yes, Ive found out what Castor does now by capturing its output beforeand after, the examples below show the results.A string longer than 55 chars is carriage returned 
, apparentlythis option is configurable to turn on off but I think Ill stick withmy first approach to trim whitespace before decrypting.Thanks.g74gqWaH7aIoQ88XEl//r/GZHnnoL0VRVsgLyTMN7xHzJtWAUdfP05oQ2EYYuPYVXzK2h8GbZM5S2Qy5K0kso+0RICTRka6ypLfTV9s6H7goSZnLYMXHh0Vsyw2HH1A8ZU1WBckSqntNEIyRqSPm7TYk98ByM9+fG1l0+kDn4OFwZCSebJQMaGLpkenryfV0AyKFTKDwfX9cD3gd10nGy3zZGwSmQleBZEAJJTTtyfqjAwEuIr6xkRYbyiAHiq2l6uz+V1F8H2uNbbgfy0QuYj40F3nIVMxUVHUu/WaIOD45Otvt3Ts7nCJtJSCznd2oNHhT8AHZ1Ylk4NRCt5gAxPJ1KR98oYsN3wSVXi3vXH6QDmKBG+HJCpAti2g/TXIFYOfA4m3YRZc7ygzqvMUgApNuHZt/mafqXJDT9aIy8mD48383kR2YdHoCRCAzGOTkg74gqWaH7aIoQ88XEl//r/GZHnnoL0VRVsgLyTMN7xHzJtWAUdfP05oQ2EYYuPYVXzK2h8GbZM5S
2Qy5K0kso+0RICTRka6ypLfTV9s6H7goSZnLYMXHh0Vsyw2HH1A8ZU1WBckSqntNEIyRqSPm7TYk
98ByM9+fG1l0+kDn4OFwZCSebJQMaGLpkenryfV0AyKFTKDwfX9cD3gd10nGy3zZGwSmQleBZEAJ
JTTtyfqjAwEuIr6xkRYbyiAHiq2l6uz+V1F8H2uNbbgfy0QuYj40F3nIVMxUVHUu/WaIOD45Otvt
3Ts7nCJtJSCznd2oNHhT8AHZ1Ylk4NRCt5gAxPJ1KR98oYsN3wSVXi3vXH6QDmKBG+HJCpAti2g/
TXIFYOfA4m3YRZc7ygzqvMUgApNuHZt/mafqXJDT9aIy8mD48383kR2YdHoCRCAzGOTk
|
|
0
|
|
|
|
Reply
|
mikew01
|
3/21/2007 9:11:49 AM
|
|
|
3 Replies
127 Views
(page loaded in 0.078 seconds)
|
|
|
|
|
|
|
|
|