HTML and CSS Reference
In-Depth Information
Plan
Ahead
Creating a well-formed XML document.
The following tasks are necessary to create a well-formed XML document, as described in
the next section:
1. Identify the tags to describe the document content and create the XML Schema
Definition (XSD).
2. Create the prolog.
3. Create the document instances.
Creating a Well-Formed XML Document
Well-Formed
Documents
A well-formed document
meets certain criteria: the
document must have at
least one root element,
and it must nest child
elements in the root;
every tag must have a
beginning and closing tag,
including empty tags; and
all attribute values must
be enclosed in quotation
marks, either single or
double, but they must be
consistent.
Database analysts refer to a collection of data as a relation . To represent the attributes
or fields in a relation, database analysts use a simple notation, called a schema. A database
schema is a logical design to show relationships, and is written as the relation name
followed by a list of attributes or fields in parentheses, in the form:
Relation_Name (attribute 1 , attribute 2 ..., attribute n )
The Relation_Name indicates the name of the collection of data, and n represents the
total number of attributes. After data analysis, a relation for the Calumet Restaurant
Supply store is developed, and using the notation style above, the logical schema design
for the XML document is written as
item (item-id, item-description, item-boh, item-brand, item-cost,
item-vendor_ID)
The name of the relation is item; the attributes within the parentheses describe things about
the each item.
A well-formed XML document consists of two main parts: the prolog and the
document instance or elements (Figure 12-3). The prolog contains the processing
instruction statements and any additional comments necessary to provide information
about the document's content and structure such as an optional Document Type
Definition (DTD) or a link to a DTD. The document instance contains the main
content or elements of the XML document. The root element of a document instance
contains the link to the XML Schema Definition file. Because the XML Schema
Definition is the preferred method for forming an XML document, this chapter discusses
how to create and link an XML Schema Definition (XSD) file to an XML file.
The prolog may contain processing instruction statements, declaration statements, or
comments. A processing instruction is one or more instructions passed to the application
using the XML document. The XML declaration is a processing instruction statement
identifying the version of XML used in the document. The prolog shown in Figure 12-3
contains an XML declaration, which is a processing instruction on line 1 followed by a
comment on line 2 identifying the file.
The XML Prolog
Every XML document must
have a prolog. The prolog
must contain at least
one line — a declaration
statement — identifying
the document as an
XML document:
<?xml version="1.0"?>.
 
Search WWH ::




Custom Search