[Grt] a brief overview of XML

A, XML foundation

The main purpose of XML (I think on these three points):

  Separating the XML data from HTML
  XML data sharing simplified
  XML simplified data transfer

 

XML syntax rules:

  • XML documents must have a root element
  • XML document must have a closing tag
  • XML tags are case sensitive
  • XML elements must be properly nested
  • XML attribute must be quoted, for example: <note date = "08/08/2008">
  • XML comments: <- This is a comment -!> 

 

E.g:

<? xml version = "1.0" encoding = "ISO-8859-1"?> // defines the XML version (1.0) and the encoding used (ISO-8859-1 = Latin-1 / Western European character sets). 
<? xml-stylesheet type = " text / css" href = "cd_catalog.css"?> // references css file 
<? xml-stylesheet type = " text / xsl" href = "simple.xsl"?> // use XLST 

<note> // root element note 
  <to> George </ to> // child element to 
  <from> John </ from> // sub-elements from 
  <heading> Reminder </ heading> 
  <body> the Do not forget Meeting The! </ body> 
</ Note>

  

In XML, five predefined entity references:

&lt; < Less than
&gt; > more than the
&amp; & And number
&apos; ' apostrophe
&quot; " quotation marks
 

Second, senior



 

Guess you like

Origin www.cnblogs.com/guorongtao/p/11274747.html