Skip to Content
XML Pocket Reference, 3rd Edition
book

XML Pocket Reference, 3rd Edition

by Simon St. Laurent, Michael Fitzgerald
August 2005
Intermediate to advanced
175 pages
4h 48m
English
O'Reilly Media, Inc.
Content preview from XML Pocket Reference, 3rd Edition

A Simple XML Document

If you’re new to XML or just need to identify a feature you haven’t seen before, looking at a sample document may be helpful. The document shown in Example 1-1 contains a variety of XML features.

Example 1-1. A simple XML document
1  <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
2  <?xml-stylesheet href="mine.css" type="text/css" ?>
3  <!--This is a very simple document.-->
4  <!DOCTYPE message SYSTEM "myMessage.dtd" >
5  <message xmlns="http://simonstl.com/ns/examples/message"
6              xmlns:xsi="http://www.w3.org/2001/XMLSchema-
               instance"
7              xsi:schemaLocation="message.xsd"
8              xml:lang="en" date="2005-10-06" >
9        This is a message!
10  </message>

This document contains many common XML structures, each of which is described briefly here and in greater detail later in this book. Line 1 is an optional XML declaration that provides version and encoding information, plus a declaration that indicates whether or not the document stands alone (i.e., whether it relies on external markup declarations). Line 2 is a processing instruction—more precisely, an XML stylesheet processing instruction that references a local CSS stylesheet. Line 3 is a comment and line 4 is a document type declaration (or DOCTYPE declaration) that points to a document type definition, or DTD. A DTD contains rules for document validation. The message element start-tag, on line 5, is the root (or document) element. This element contains several attributes with varying purposes. The attribute on line 5 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Special Edition Using XML, Second Edition

Special Edition Using XML, Second Edition

- et al. David Gulbransen
.NET & XML

.NET & XML

Niel M. Bornstein
Succeeding as a First-Time Parent (HBR Working Parents Series)

Succeeding as a First-Time Parent (HBR Working Parents Series)

Harvard Business Review, Daisy Dowling, Eve Rodsky, Bruce Feiler, Amy Jen Su

Publisher Resources

ISBN: 9780596100506Errata Page