Last Modified: 1/29/08
  Computer Training
Introduction to XML

Well Formed

A well-formed XML file conforms to XML syntax and adheres to a strict tree structure, such that there are no overlapping elements and each element has one parent node.

For example, the following document is not well formed:

    <SHAPE> rect <SIZE> </SHAPE> 3x8 </SIZE> 
because the elements overlap.

Verifying that a file is well formed is the first step in assuring that it is ready for use. The Microsoft IE5 browser will test any XML file for well-formedness.

The Basic Rules of XML Syntax

The following are the basic rules of XML syntax:

  1. XML Declaration
    Begin the document with an XML declaration. For example:
    <?xml version="1.0"?>
  2. Root Element
    Have a root element that completely contains all other elements.
  3. Start And End Tags
    Use both start and end tags in non-empty tags.
  4. Case Sensitive
    XML is case sensitive. For example, <First_name> is not the same tag as <first_name>.
  5. Empty Tags
    End empty tags with "/>".
  6. No Overlap
    Do not overlap elements.
  7. Attributes In Quotes
    Enclose attribute values in quotes.
  8. < and &
    Only use < and & to start tags and entities.
  9. Entities
    Use only the five pre-existing entity references: &amp;(&), &lt;(<), &gt;(>), &apos;('), &quot;(")

An XML file does not need a Document Type Definition (DTD) or a schema to be tested for well-formedness.

Previous Home Next

Topics

Summary

HTML Is Not Enough

What Is XML?
  Ontologies
  SGML, HTML, & XML

XML Basics
  HTML Example
  XML File
  Structure
  Paths
  Well-Formed
  DTDs
  Schemas
  Validation
  Unicode
  What It Means

Transforming For
Presentation

  DHTML
  CSS
  XSL

Serving And Processing XML
  Server Side
  Client Side

XML Applications   Information Reuse
  B2B
  Text Encoding
  Syndication

Security

XML Resources On The Web

Part Two Of Class

 
Previous Home Next

Other Topics:   XML Editors

©1999 UW Technology