Results 1 to 1 of 1
Jul 12, 2004, 16:57 #1
- Join Date
- May 2003
- somewhere on the Earth
- 0 Post(s)
- 0 Thread(s)
xml question about storing special chars
Hey I've got several questions about XML. Hope you can give me some idea.
1. html entities.
I know <, >, ', " and & should be converted to their html equivalents when stored in a xml file. but what about when & appears in a url address? for example:
<xml> <url>http://whatever.com/index.php?user=whoever&do=whatever</url> <attr url='http://whatever.com/index.php?user=whoever&do=whatever'> or another one</attr> </xml>
CDATA sections begin with a <![CDATA[ and end with a ]]>. and it's said that I could store original <, >, ', " and &.
but what about when the user inputs contains ]]> which is the close tag of the CDATA section? for example:
<xml> <cdata><![CDATA][ so I can put < > ' " & here. but wait what if I put a "]]>" here? ]]></cdata> </xml>
I know attributes value must be within two single/double quotes like:
<xml> <attr1 value='some value here within two single quotes' /> <attr2 value="or some within two double quotes" /> </xml>
<xml> <attr1 value='a double quote " here within two single quotes' /> <attr2 value="or a single quote ' within two double quotes" /> </xml>
<xml> <quote>JC said, " should I do this 'BAD' thing here?"</quote> </xml>
Last edited by zjcboy; Jul 13, 2004 at 07:10.