Here is an example of an XSQL page where three attributes are used: <connec-
tion>, <xmlns:xsql>, and <tag-case>.
<page connection=demo xmlns:xsql=urn:oracle-xsql>
select * from emp
You know almost everything that you need to know to create well-formed XML docu-
ments. There are a couple of rules that you havent seen yet, though. This section acts
as a review of the rest of the syntax rules. The most common restrictions that you will
encounter involve the names of elements and attributes. This is covered first. XML, like
most languages, has reserved characters. Sometimes, youll want to use these, so youll
learn how. One option youll learn about is the CDATA entity, which allows you to
define special sections of character data. The final section here covers XML comments.
There is one instruction that isnt discussed here: <!DOCTYPE>. It is used to specify
a Document Type Definition (DTD), a type of schema. Before covering the rest of the
syntax rules of XML, lets review the syntax rules that have already been covered:
You must have an XML processing instruction at the top of the document.
There can be only one root element.
Start tags must have matching end tags, and vice versa.
Tags must be nested correctly.
A particular attribute can appear only once per element.
Attribute values must be enclosed in single or double quotes.
Element Name and Attribute Restrictions
Element names and attributes share the same restrictions. Both must be composed
entirely of the same set of characters. This set consists of all alphanumeric characters,
the underscore, and the period. The colon is also valid, but has special meaning
youll learn more about that when XML namespaces are discussed. A name or attribute
can only start with an underscore or a letter. The last restriction is that no name or
attribute may begin with the string xml. Case-insensitive Table 1.2 gives examples of
legal and illegal strings.
271209 Ch01.F 12/9/02 2:00 PM Page 18