General XML Syntax Rules

 

ATTENTION: THIS PAGE IS Valid HTML 5 AND IS BEST VIEWED WITH HTML 5 - Please upgrade your browser or download one of the HTML 5 compatible browsers such as Mozilla Firefox, Chrome, Opera or IE 9 (March 14, 2011 or later). For more information see HTML 5 browsers.


If you find this helpful, please click the Google +1 Button to the left, if it is white, to make it turn blue or red. Thank you! (It also helps find this page again more easily.)


PDF mobile

General Rules for Coding XML Documents

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet ...?>
<!DOCTYPE top-elem-name>
<top-elem-name ...>
   ...
</top-elem-name>
General rules for coding XML-based feeds
  • Certain special characters need to be escaped to avoid having the code interpreted as a delimiter or other special meaning:
    escape all ampersand (&) characters
    escape all ampersands with &amp; to prevent them from being interpreted as XML character entities
    escape all less than (<) symbols
    escape all < symbols with &lt; to prevent them from being interpreted as the starting delimiter of an XML tag
    escape all greater than (>) symbols
    escape all > symbols with &gt; to prevent them from being interpreted as the ending delimiter of an XML tag
    escape double quotes (") within double-quoted attributes
    escape double quotes in attributes as &quot;
    escape apostrophes (') within single-quoted attributes
    escape apostrophes (single quotes) in attributes as &apost;
    escape special characters
    escape other special characters using the appropriate decimal character code (&#nnn;) or hexadecimal character code (&#xnnnn;). For example, code a non-breaking space as either &#160; or &#xa0; (not &nbsp;).

Valid HTML 5