Re: How to allow < > % within xml

Subject: Re: How to allow < > % within xml
From: Mike Brown <mike@xxxxxxxx>
Date: Tue, 16 May 2000 21:34:33 -0600 (MDT)
> To allow html tags with in html content , we do have htmlencode . similarly 
> do we have any method to allow the special characters like < > % to be 
> allowed within a xml content .
> 
> Ex : <Address> My new % Address <just> </Address>

% has no special meaning in XML, outside of a DTD, so it does not need to
be escaped. Characters that do need to be escaped are < > & and in certain
uncommon situations ' and ". They need to be escaped because they are used
to delineate markup from character data. &lt; &gt; &amp; &apos; &quot; are
the escaped forms of the characters.

	<Address> My new % Address &lt;just&gt; </Address>

The other option is to use CDATA sections, whose only purpose is to
avoid the need to escape the markup characters:

	<Address><[!CDATA[ My new % Address <just> </Address>]]>

There are many other requirements for well-formedness that are detailed in
the XML 1.0 Recommendation. In the future, please direct general XML
questions to a more appropriate forum, like the comp.text.xml newsgroup.

   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread