Site Tools


notes:xml_cheat_sheet

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
notes:xml_cheat_sheet [2026/06/04 13:49]
47.82.14.6 old revision restored (2007/10/04 01:29)
notes:xml_cheat_sheet [2026/06/07 07:31] (current)
8.209.74.18 old revision restored (2007/10/05 18:53)
Line 1: Line 1:
 ===== XML Cheat Sheet ===== ===== XML Cheat Sheet =====
  
-I stumble across XML documents intermittently and every time I need to review the basics again. This is a cheat sheet so that I can review it whenever I need to. Information here is a summarized form of the [[http://www.w3schools.com/xml/default.asp | XML Tutorial]]+I stumble across XML documents intermittently and every time I need to review the basics again. This is a cheat sheet so that I can review it whenever I need to. This is a summarized form of the [[http://www.w3schools.com/xml/default.asp | XML Tutorial]]
 + 
 +Also see the following related cheat sheets : 
 +  * [[DTD Cheat Sheet]] 
 +  * [[XML Schema Cheat Sheet]] 
 + 
 +For reference this is the [[http://www.w3.org/TR/REC-xml/  | XML Specification]] and the [[http://www.xml.com/axml/testaxml.htm | version annotated by Tim Gray]].
  
 ==== What is XML ==== ==== What is XML ====
  
-  * E**X**tensible **M**arkup **L**anguage (XML) is a markup language designed to describe data. It has no predefined tags and uses a Document Type Definition (DTD) or an XML Schema to describe the data. An XML document together with its DTD or XML Schema is self-descriptive.+  * E**X**tensible **M**arkup **L**anguage (XML) is a markup language designed to describe data. It has no predefined tags.
  
-  * XML uses text files to store data and can be used to create new languages e.g. WAP, WML, XHTML etc.+  * XML uses a Document Type Definition (DTD) or an XML Schema to describe the data. An XML document together with its DTD or XML Schema is self-descriptive. 
 + 
 +  * XML Schema is the successor to DTD because it is richer and more extensible. 
 + 
 +  * XML uses text files to store data and can be used to create new languages e.g. WAP, WML, XHTML, RSS, SOAP etc.
  
   * Because XML documents may contain Unicode characters, they should be saved as Unicode text files. The encoding attribute should be the same as the encoding that the text file is saved as.   * Because XML documents may contain Unicode characters, they should be saved as Unicode text files. The encoding attribute should be the same as the encoding that the text file is saved as.
 +
 +  * XML files are completely platform-independent and portable (EBCDIC platforms ?).
 +
  
 ==== XML Syntax ==== ==== XML Syntax ====
Line 28: Line 41:
   * The first line is an XML declaration which defines the XML version and the character encoding used in the document.   * The first line is an XML declaration which defines the XML version and the character encoding used in the document.
  
-  * XML tags are case-sensitive and must have a corresponding closing tag. Tags must be properly nested.+  * XML tags are case-sensitive and must have a corresponding closing tag. Empty elements can combine the start and closing tag e.g. <br />. 
 + 
 +  * XML tags must be properly nested.
  
   * An XML document must have a root element (note in the above). All elements may have child elements.   * An XML document must have a root element (note in the above). All elements may have child elements.
Line 46: Line 61:
   * AN XML document which is well-formed and conforms to the rules of a DTD or XML Schema is described as valid.   * AN XML document which is well-formed and conforms to the rules of a DTD or XML Schema is described as valid.
  
-  * A DTD or XML Schema defines the document structure with a list of legal elements.+  * A DTD or XML Schema defines the document structure with a list of legal elements and attributes. 
  
 ==== XML Elements ==== ==== XML Elements ====
Line 70: Line 86:
   * A CDATA section starts with "<![CDATA[" and ends with "]]>":   * A CDATA section starts with "<![CDATA[" and ends with "]]>":
  
-  * Everything inside a CDATA section except for [[> is permitted.+  * Everything inside a CDATA section except for ]]> is permitted.
  
 ==== XML Attributes ==== ==== XML Attributes ====
Line 79: Line 95:
  
   * Although data can be stored either in child elements and attributes, attributes should really be used for metadata i.e. data about the data which is not part of the data itself. For example an element id is best stored in an attribute.   * Although data can be stored either in child elements and attributes, attributes should really be used for metadata i.e. data about the data which is not part of the data itself. For example an element id is best stored in an attribute.
 +
  
 ==== XML Namespaces ==== ==== XML Namespaces ====
 +
 +  * XML Namespaces is covered as a [[http://www.w3.org/TR/REC-xml-names/ | separate XML recommendation]] .
  
   * XML namespaces allow element names from XML documents not to conflict if they mean something different.   * XML namespaces allow element names from XML documents not to conflict if they mean something different.
Line 102: Line 121:
   * **C**ascading **S**tyle **S**heets (CSS) are used to display XML by associating styles with element types.   * **C**ascading **S**tyle **S**heets (CSS) are used to display XML by associating styles with element types.
  
-  * An XML document is associated with a stylesheet using +  * An XML document is associated with a stylesheet using
 <code> <code>
 <?xml-stylesheet type="text/css" ref="simple.css"?> <?xml-stylesheet type="text/css" ref="simple.css"?>
notes/xml_cheat_sheet.1780606150.txt.gz · Last modified: 2026/06/04 13:49 by 47.82.14.6