< prev | next >

Syntax < Home

Syntax

WxML is loosely based on the Extensible Markup Language (XML), which is a new standard for open, web-based documents. Since XML has only recently been accepted as a final standard by the W3C, and since I've got a development schedule to meet, the current incarnation of WxML is not fully XML compliant. My intent is to keep an eye on the XML standard in hopes of adopting it as the official basis of WxML in the future.

There is much information on the web regarding XML, if you're interested in learning more about it. Here are a few links to good articles:

As with other tag-based markup languages, the syntax of WxML supports hierarchical constructs of nested tags. Each tag specifies a construct or property of the tag in which it is embedded. Attributes are used to specify characteristics of tags or to modify their behavior.

Tags

WxML tags come in two forms: the begin tag and the end tag. WxML begin tags take the form of a tag name delimited by "<" and ">". The tag name can consist of any combination of letters and digits, but it must begin with a letter. Unlike HTML, tag names in WxML are case sensitive and are predominantly lowercase. The corresponding WxML end tag is the same as its begin tag, but with a "/" after the opening "<":

<tag> ... </tag>

Hierarchical structures are defined in WxML by nesting tags within other tags. Nested tags appear within a begin/end tag pair :

<parent>
  <child> ... </child>
</parent>

Subtags that are nested within another tag are called children of that tag. The tag that contains the subtags is called their parent. Children must be balanced and completely contained within their parent:

This is legal:

This is not:

<parent>
  <child>
  </child>
</parent>
<parent>
 <child>
</parent>
 </child>

Tags may be nested as deeply as you like, and a parent tag can contain multiple children as long as they are completely balanced:

<parent>
  <a>
  </a>
  <b>
    <c>
    </c>
    <d>
      <e>
      </e>
    </d>
  </b>
 </parent>

Begin and end tags must be completely balanced within a document. That is, every begin tag must have a corresponding end tag. If a tag does not contain any children, it may be abbreviated using the empty tag form:

An empty begin/end
tag pair:

May be abbreviated
like this:

<emptyTag>
</emptyTag>
<emptyTag/>

Attributes

Attributes are used to specify the characteristics of a tag or to modify its behavior. An attribute takes the form of a name/value pair:

attributeName="attributeValue"

Attribute names may consist of any combination of letters and digits, but they must begin with a letter. Attribute names are case sensitive. Attribute values must be enclosed in double quotes, and can contain any printable ASCII characters except the double quote.

A tag's attributes are listed within the begin tag, after the tag name but before the closing ">". A tag may have multiple attributes:

<tag name="Arthur" quest="grail" color="blue">
  <subTag> ... </subTag>
</tag>

When using the empty tag form, attributes are listed after the tag name but before the "/":

<tag name="Arthur" quest="grail" swallow="European"/>

Confidential. Copyright © 2002, Oklahoma Climatological Survey. All Rights Reserved.
Send questions or comments concerning this web page to
wolfie@ou.edu.