=========
XML Notes
=========
No prebdefined tags, define your own, XML schema or DTD to descrive data
XML used to create XHTML and RSS::
XML declaration defines version and encoding
XML must contain root element (parent of other elements)
Syntax Rules
============
- closed tags
- case sensitive tags
- elements properly nested
- must have root element
- attributes quoted
- errors stop XML app
XML comment::
CDATA
like comments, everything inside ignored by parser::
- white spaces are not removed
- attributes have info not part of data
- attributes must be enclosed into qutoes single or double
- meta data should be stored as attributes
Sample Code::
blah
blach
Embeded XML (in html)::
XML table::
XML table with more info::
Tom
80
80
Namespace of element associates to child elements with same prefix::
xmlns:namespace-prefix = "namespace URL"
- saving xml as unicode to understand foreign chars
creates errors in netscape if xml has foreign chars
netscape error if encoding is UTF-16
Escape Chars::
< = <
> = >
& = &
' = '
" = "
XML DTD
Defines structure of XML documet, with list of legal elements
alternative to schema
XML STYLE
CSS to style XML::
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