Re: Castor parsing
"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