Introducing XML

XML Declaration
<?xml version="version number" encoding="encoding type" standalone="yes|no" ?>

 

Term Description Default value
Version number the version of the XML specification being used in the document 1.0
Encoding type identifies the character set used in the document UTF-8
Standalone attribute indicates whether the document contains any references to external files. If so, such references usually point to DTDs contained in external value of "no" indicates that the document requires additional information from external documents. no

 

Processing Instruction
<? Target instruction ?>
Example: <?xml-stylesheet type="text/css" href="url" ?>

 

Comments
<!-- comment text --> Same as HTML comments

 

Namespaces
Two steps in applying a namespace to an XML document
1. Declaring the namespace xmlns:prefix="uri" <model xmlns:mod="http://jacksonelect.com/models">
2. Identifying the elements and attributes within the document that belong to that namespace
The general form for applying a qualified name to a two-sided tag is: <prefix:element> … </prefix:element> This is applying a namespace to an element
To apply a namespace to an attribute <element prefix:attribute="value"> … </element>
Default namespace syntax <element xmlns="uri"> … </element> Omit prefix in namespace declaration Usually use on html element
To declare a namespace in a style sheet, you add the following rule to the style sheet file @namespace prefix url(uri); @namespace mod url(http://designingcontent.com/models);
Applying a namespace to a selector prefix|selector {attribute:value;} mod|title {width: 150px;} For IE browsers, use \: instead of |