0% found this document useful (0 votes)
53 views

XML Structure: Document Parts

This document describes the structure of XML documents, including the prologue, document element, and provides an example XML document. The prologue contains an XML declaration and can reference a DTD. A well-formed XML document must have one root element containing the entire document. The example document shows a LAND element containing FOREST and MEADOW elements with child elements for different types of trees and grasses. The document also discusses using CSS stylesheets to control how XML documents are displayed.

Uploaded by

Megha Bansal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

XML Structure: Document Parts

This document describes the structure of XML documents, including the prologue, document element, and provides an example XML document. The prologue contains an XML declaration and can reference a DTD. A well-formed XML document must have one root element containing the entire document. The example document shows a LAND element containing FOREST and MEADOW elements with child elements for different types of trees and grasses. The document also discusses using CSS stylesheets to control how XML documents are displayed.

Uploaded by

Megha Bansal
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

XML Structure

This page provides a description of XML structure including the document parts, the
prologue, and provides a simple XML example document.

Document Parts

 Prolog
 Document Element (root element)

The Prologue

The prologue, equivalent to the header in HTML, may include the following:

 An XML declaration (optional) such as:

<?xml version="1.0"?>

 A DTD or reference to one (optional). An example reference to an external


DTD file:

<!DOCTYPE LANGLIST SYSTEM "langlist.dtd">

 Processing instructions - An example processing instruction that causes style


to be determined by a style sheet:

<?xml-stylesheet type="text/css" href="xmlstyle.css"?>

An XML Document

Therefore a complete well formed XML document may look like:

<?xml version="1.0"?>
<LAND>
<FOREST>
<TREE>Oak</TREE>
<TREE>Pine</TREE>
<TREE>Maple</TREE>
</FOREST>
<MEADOW>
<GRASS>Bluegrass</GRASS>
<GRASS>Fescue</GRASS>
<GRASS>Rye</GRASS>
</MEADOW>
</LAND>

The LAND element, above, is the root element.


The below document is not an XML document since it does not qualify by the rules of a
well formed document. There is more than one top level element which disqualifies the
document from being well formed.

<?xml version="1.0"?>
<FOREST>
<TREE>Oak</TREE>
<TREE>Pine</TREE>
<TREE>Maple</TREE>
</FOREST>
<MEADOW>
<GRASS>Bluegrass</GRASS>
<GRASS>Fescue</GRASS>
<GRASS>Rye</GRASS>
</MEADOW>

Defining Display

If the HTML document is not linked to a style sheet, the XML document will be
displayed with tags included. The elements and tags may be color coded to aid in viewing
the document. The document is displayed without tags according to the style sheet if a
link to one is specified. The following document shows a document with a link to a
cascading style sheet:

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="xmlstyle.css"?>
<DATABASE>
<TITLE>List of Items Important to Markup Languages</TITLE>
<TITLE2>Languages</TITLE2>
<LANGUAGES>SGML<LANGUAGES>
<LANGUAGES>XML</LANGUAGES>
<LANGUAGES>HTML<LANGUAGES>
<TITLE2>Other</TITLE2>
<OTHER>DTD<OTHER>
<OTHER>DSSL<OTHER>
<OTHER>Style Sheets</OTHER>
</DATABASE>

The below line, which is a part of the XML document above, is a processing instruction
and is a part of the prolog.

<?xml-stylesheet type="text/css" href="xmlstyle.css"?>

The style sheet, "xmlstyle.css", may look like:

DATABASE
{ display: block }
TITLE
{ display: block;
font-family: arial;
color: #008000;
font-weight: 600;
font-size: 22;
text-align: center }
TITLE2
{ display: block;
font-family: arial;
color: #000080;
font-weight: 400;
font-size: 20 }
LANGUAGES
{ display: block;
list-style-type: decimal;
font-family: arial;
color: #000000;
font-weight: 400;
font-size: 18 }
OTHER
{ display: block;
list-style-type: square;
font-family: arial;
color: #0000ff;
font-weight: 200;
font-size: 14 }

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy