HTML and CSS Reference
In-Depth Information
XML Processing Instructions
Table H-2 shows the basic form of the declarations, statements, and comments
found in the prolog section of an XML document.
Table H-2 XML Instructions
Instruction
General Form
Example
Comment
XML declaration
<?xml version 5 "#"
[encoding 5 "encoding"
standalone 5 "yes|no" ]?>
<?xml version="1.0"
standalone="yes"?>
Defines version, character encoding, and if
DTD is required to parse XML document;
standalone="yes" means no external markup
documents impact the XML data processed by the
parser
Document type
declaration
<!DOCTYPE ROOT-ELEMENT
PUBLIC/SYSTEM="URL-DTD.DTD">
<!DOCTYPE PHONELIST
SYSTEM="PHONELIST.DTD">
PUBLIC indicates location of public DTD; SYSTEM
indicates location of private DTD
Processing
Instruction
<?target attribute="value" ?>
<?xml-stylesheet type="text/xsl"
href="products.xsl"?>
Gives instruction to the application to access a
document or file outside the application (in this
example, a style sheet); can include one or more
attributes
Comment
<!--Comments -->
<!-- File Name: products.xml -->
Provides a user or developer with information
about the document; comments are ignored by
application
Character
Data Type
(Unparsed)
<![CDATA [text]]>
<![CDATA [The <b> tag
should always have an end
</b> tag. ]]
Special section of character data not interpreted
as markup, as opposed to parsed character data
(PCDATA), to which the XML syntax rules apply;
CDATA sections often used to show XML or HTML
syntax examples
XML Element and Attribute Rules
Elements must be bound by start and end tags or be an empty element. Elements
may contain other elements, but they must be nested in the proper order. Table H-3 lists
the syntax rules for creating valid XML elements. Table H-4 contains a list of element
rules. Table H-5 shows examples of valid, invalid, and empty XML elements.
Table H-3 XML Element Syntax Rules
Rule Number
Rules
1
Must begin with a letter or an underscore
2
May contain letters, numbers, hyphens, periods, or underscores
3
May not contain spaces, commas, or symbols (@#$%^&*!)
4
May not begin with XML, which is reserved for future use
5
Names are case sensitive; start and end tags must use same case
6
Colons are acceptable only for declaring namespaces
7
Empty elements have no text or values, but may contain attributes
Search WWH ::




Custom Search