[jdom-interest] escape characters within a element text

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Oct 29 07:11:52 PST 2003


At 3:31 PM +0200 9/30/03, Niroshan wrote:
>hi
>	if i have a string which is a xml, but contains invalid 
>characters within the elements text, how can i create a xml document 
>out of it.
>	If the string is as below
>
>	<person>
>		<name>jack </name>
>		<description> height of jack is < 6 feet </description>
>	</person>
>

You're working from false premises. The string above is not XML. If 
you change "is < 6" to "is &lt; 6" then it becomes well-formed XML, 
and you can process it.
-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list