No prebdefined tags, define your own, XML schema or DTD to descrive data
XML used to create XHTML and RSS:
<?xml version="1.0" encoding="ISO-8859-1" ?>
XML declaration defines version and encoding
XML must contain root element (parent of other elements)
XML comment:
<!-- comment -->
like comments, everything inside ignored by parser:
<![CDATA[ comment goes here ]]>
Sample Code:
<?xml version = "" encoding = "" ?>
<root element>
<child>blah</child>
<elements>blach</elements>
</root element>
<!-- comment -->
Embeded XML (in html):
<xml id="note" src="note.xml"></xml>
XML table:
<table><tr>
<td>Apples</td>
</tr></table>
XML table with more info:
<h:table>
<h:name>Tom</h:name> <!--Prefix tags to avoid element name conflicts-->
<h:width>80</h:width>
<h:length>80</h:length>
</h:table>
Namespace of element associates to child elements with same prefix:
xmlns:namespace-prefix = "namespace URL"
Escape Chars:
< = <
> = >
& = &
' = '
" = "
CSS to style XML:
<?xml-stylesheet type="text/css" href="cd_catalog.css" ?>
XSL (extensible stylesheet language)
Parse XML via Javascript:
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); //create instace of IE parse
var xmlDoc = document.implementation.createDocument("ns", "root", null); //ns = name space used, root = xml root element
xmlDoc.async="false"; //does not execute until full script is loaded