File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes ask for solution to encode less than sign  in string to make the string xml-compliant Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "ask for solution to encode less than sign  in string to make the string xml-compliant" Watch "ask for solution to encode less than sign  in string to make the string xml-compliant" New topic
Author

ask for solution to encode less than sign in string to make the string xml-compliant

rose deng
Ranch Hand

Joined: Dec 29, 2000
Posts: 78
Hi,
As far as i know, & and < are special characters for xml. so we need to escape those two characters to make the string be well-formed xml string.
& is easy to handle, just encode it to &.afer validation or transformation, decode it back.
My question is how to encode < sign in element value, seems can not just encode it to <, since open tag contains < sign.
If you have solution, share with me please.
Huge thanks.
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
<
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 949
This link contains the correct encodings for ampersand, lessthan, greaterthan, quote, a single quote.
(I tried to post them but didn't know how to escape some of the symbols, so that post was messed up.)


Please ignore post, I have no idea what I am talking about.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18652
&lt;
...which you get in UBB by typing
&amp;lt;
...which you get in UBB by typing
&amp;amp;lt;
...which you get in UBB by typing
&amp;amp;amp;lt;
...


"I'm not back." - Bill Harding, Twister
 
 
subject: ask for solution to encode less than sign in string to make the string xml-compliant
 
Threads others viewed
HTML file within an XML file
passing string with href..(URGENT)
XML within string parameter to RPC Service
JSP converting my encoded quotes
special character in xml
developer file tools