TOC 2 XML Basics

The eLesson Markup Language eLML is hierarchically structured. Hierarchical models are convenient for representing data consisting of many elements and sub-elements. XML is perfectly suited for representing hierarchical models. An XML document is a hierarchy comprised of elements that have sub-elements, attributes and contents.

TOC UP 2.1 Elements

An element is a component of a document that has been identified in a way a computer can understand. Each element has a tag name. When a tag name is shown as <tagName>, with less-than and greater-than symbols before and after the tag name, it serves as the start-tag to mark the beginning of an element. When that same tag name has a forward slash "/" added, it serves as an end-tag such as </tagName>. An element may have contents between its start and end-tags, and may have one or more attributes. When an XML element has a start and end-tag (also called an opening and closing tag) with a common name, it is considered to be "well-formed" XML. The contents of an element are placed between the start and end-tags as shown below:

<tagName>contents</tagName>
Note that XML is case-sensitive in its processing of tag names. eLML defines element names in lowerCamelCase.

TOC UP 2.1.1 Element Contents
An element may contain other elements, text, numbers, enumerations, etc. or a mixture of these. The allowable contents of an element are its content model.

TOC UP 2.1.2 Element Attributes
An attribute provides additional information about an element. An element may have more than one attribute. Attributes are contained within the start tag of an element. They are represented by an attribute name followed by an equal sign and the attribute value in quotation marks:

<tagName>
<tag attributeName="
attributevalue">contents</tag>
</tagName>

Note that XML is case-sensitive in its processing of attribute names. eLML defines attribute names in lowerCamelCase.

TOC UP 2.2 Document Type Definitions DTD

The tag name, content model, and attributes of elements can be defined in a Document Type Definition (DTD). This is an external file which can be referenced from any XML document that wants to use this definition. The DTD defines the elements that may be used and may define the contents of the elements.
As DTD is the older standard for defining XML models eLML uses the newer standard XML Schema which is describe in the following paragraph.

TOC UP 2.3 XML Schemas

A schema is a formal specification of element names that indicates which elements are allowed in an XML document, and in which combinations. New schema languages, such as those defined in the XML-Schemas Working Group, provide the same baseline functionality as a DTD. However, because these schema languages are extensible, developers can augment them with additional information, such as data types, inheritance, and presentation rules. This makes these new schema languages far more powerful than DTDs. For more information about XML schemas see the W3C XML Schema Recommendation on http://www.w3.org/TR/xmlschema-0/.


Previous "Introduction"    |   Top   |    TOC    |   Next "eLML XML Schemas"