Wednesday, July 26, 2006

XML special character

XML understand only thress special characters "& lt;", "& gt;" and "& amp;"
While copying data from html to xml, must be very careful.
Most common error happens for "& nbsp;" which is not allowed in xml/xsl without a declaration.
Fix: change "& nbsp; " to " & #160; " before push it to xml doc.

Also we should change "<" to "& lt;", ">" to "& gt;" before push.
Also note "&" is not allowed for xml doc, however in most HTML pages it has already been changed to "& amp;", which will be valid in XML, so we don't need to take care of this case generally.

No comments: