XML Document

   

Entities

The content of an element can include entities. An entity is shorthand for a piece of text. Entities are declared in the DTD (see the previous section) and have a name and a content. In addition, entities are inserted in the document between the & and ; characters .

Assuming the entity axs was declared with the content Applied XML Solutions , the parser will resolve

 <title>&axs;</title> 

as

 <title>Applied XML Solutions</title> 

Predefined Entities

XML predefines a small number of entities to escape special characters:

  • &lt; ”Stands for <

  • &amp; ”Stands for &

  • &gt; ”Stands for >

  • &apos; ”Stands for '

  • &quot; ”Stands for "

Character Entities

XML also defines character entities. A character entity references a single Unicode character. They are typically used to call characters that are not legal in the current encoding.

The name of character entities has the form # number , where number is the Unicode code for the character. For example, is Unicode character 169 , so

 <notice>&#169; 2000, Pineapplesoft</notice> 

is equivalent to

 <notice> 2000, Pineapplesoft</notice> 
   


Applied XML Solutions
Applied XML Solutions
ISBN: 0672320541
EAN: 2147483647
Year: 1999
Pages: 142

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net