XmlFile Containing the & Character in text
XmlFile Containing the & Character in text
(OP)
Just a query about the & character in an xml file
Say Text = Me & my dog?
I run it through a UTF-8 conversion and i get
Me & My Dog?
I am planning using this file for a game on the internet
?? will i have any problems with the &
Appreciate any advice
Regards Robert
Say Text = Me & my dog?
I run it through a UTF-8 conversion and i get
Me & My Dog?
I am planning using this file for a game on the internet
?? will i have any problems with the &
Appreciate any advice
Regards Robert
RE: XmlFile Containing the & Character in text
A UTF-8 converter should not transform & into anything else and just leave it as it is.
The string Me & my dog? must be encoded in XML as Me & my dog? or, if (part of) a text node inside an element, as <![CDATA[Me & my dog?]]>
RE: XmlFile Containing the & Character in text
Just double confirming
Yes the original is <Me & my Dog?> ie its is within <>
do i have to make it <Me &amp; My Dog?>
or <![CDATA[Me & my dog?]]>
if i leave it as <Me &amp; My Dog?> it seems to load into a browser ok
I am pretty new to xml hope i do not sound too vague !!@@!
Regards Robert
RE: XmlFile Containing the & Character in text
You mean within ><, right?
If you encode your text as Me &amp; my dog?, the system that will read your XML data will interpret it as Me & my dog?, while if you encode as Me & my dog? the document contents will be read as Me & my dog?, which is what you intend.
The reason why & must be encoded as & is because it signals an escape sequence that textually represents (among others) the characters that serve some purpose in XML: <>'" and & itself (as a consequence of its role).
RE: XmlFile Containing the & Character in text
Thanks for your help...much appreciated
Regards Robert