From Wikicliki
Jump to: navigation, search

The diference between XML and HTML is that XML was designed to transport and store data, while HTML was designed to display data.

XML does not do anything. It merely holds information. It has no predefined tags. You invent your own tags in XML. Its not a replacement for HTML, which can only use HTML tags, and is meant to display information and format it in pretty ways.


  1. XML elements must be properly nested and not overlap
    • CORRECT: <title> Romeo and Juliet <author> Shakespeare </author> </title>
    • WRONG: <title> Romeo and Juliet <author> Shakespeare </title> </author>
  2. Empty elements may contain attributes
    • All the following are correct:
    • <food name="orange"></food>
    • <food name="orange" />
    • <food name="orange"/>
  3. You can define entities
    • 5 predeclared entities for symbols: & , < > ' "
    • Define an entity in the DTD: <!DOCTYPE example [ <!ENTITY copy "©"> ]> and then call it up with ©
    • You can have entitites inside entities as long as they are declared in order.

Displaying XML

  • if you feed an xml doc straight to a browser, it will be rendered as raw xml text. (some with handles on margin)
  • you can render it with css but then your xml must have this: <?xml-stylesheet type="text/css" href="myStyleSheet.css"?>


XPath may be used to compute values (strings, numbers, or boolean values) from the content of an XML document.

See Also