Difference between revisions of "XML"

From Wikicliki
Jump to: navigation, search
Line 10: Line 10:
 
# Empty elements may contain attributes
 
# Empty elements may contain attributes
 
#* All the following are correct:
 
#* All the following are correct:
#* <font color=green><food name="orange"></food></font>
+
#* <font color=green><food name="orange" state="decomposing"></food></font>
#* <font color=green><food name="orange" /></font>
+
#* <font color=green><food name="orange" state="decomposing" /></font>
#* <font color=green><food name="orange"/></font>
+
#* <font color=green><food name="orange" state="decomposing"/></font>
  
  

Revision as of 10:16, 17 September 2008

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.

well formed XML:

  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" state="decomposing"></food>
    • <food name="orange" state="decomposing" />
    • <food name="orange" state="decomposing"/>


XPath

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