Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Castor parsing

Thread view: 
mikew01 - 20 Mar 2007 10:46 GMT
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
mikew01 - 20 Mar 2007 10:54 GMT
Just to add to the above, the data I am trying to parse is between a
set of tags, not the whole xml file.
Oliver Wong - 20 Mar 2007 17:19 GMT
> Hi,
>
[quoted text clipped - 18 lines]
>
> 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
mikew01 - 21 Mar 2007 10:11 GMT
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 &#xd;, 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&#xd;
2Qy5K0kso
+0RICTRka6ypLfTV9s6H7goSZnLYMXHh0Vsyw2HH1A8ZU1WBckSqntNEIyRqSPm7TYk&#xd;
98ByM9+fG1l0+kDn4OFwZCSebJQMaGLpkenryfV0AyKFTKDwfX9cD3gd10nGy3zZGwSmQleBZEAJ&#xd;
JTTtyfqjAwEuIr6xkRYbyiAHiq2l6uz+V1F8H2uNbbgfy0QuYj40F3nIVMxUVHUu/
WaIOD45Otvt&#xd;
3Ts7nCJtJSCznd2oNHhT8AHZ1Ylk4NRCt5gAxPJ1KR98oYsN3wSVXi3vXH6QDmKBG
+HJCpAti2g/&#xd;
TXIFYOfA4m3YRZc7ygzqvMUgApNuHZt/mafqXJDT9aIy8mD48383kR2YdHoCRCAzGOTk


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.