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 2008

Tip: Looking for answers? Try searching our database.

existing utility class to escape/unescape xml

Thread view: 
NetKev - 04 Mar 2008 21:30 GMT
I use JAXB to stuff some data into xml and pass it on to a client-side
ajax application.  I'm thinking I need to escape the data before
stuffing it in.  Are there any available utility classes to do this?
I will eventually need to do the reverse when I get data from the
client app.

Incidentally, I need to do the same thing in javascript on the client
side and it needs to be compatible with the java implementation.  Any
pointers for that will help me as well.

-Kevin
Owen Jacobson - 04 Mar 2008 23:39 GMT
> I use JAXB to stuff some data into xml and pass it on to a client-side
> ajax application.  I'm thinking I need to escape the data before
[quoted text clipped - 7 lines]
>
> -Kevin

JAXB handles this for you.  So do the underlying DOM APIs.  So does
SAX, if you want to go that way.  Pretty much any sensible API for
processing XML will automatically translate between the value of an
attribute or text node (which does not contain escape sequences) and
the representation (which does).

Thus, if you serialize a bean containing the string "foo & bar" as a
field value using JAXB, the resulting XML should contain "foo &
bar" in the appropriate place.

-o


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.