blank.gif (43 bytes)

Church Of The
Swimming Elephant

Search:
3.1. SGML Documents Connected: An Internet Encyclopedia
3.1. SGML Documents

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1866
Up: 3. HTML as an Application of SGML
Prev: 3. HTML as an Application of SGML
Next: 3.2. HTML Lexical Syntax

3.1. SGML Documents

3.1. SGML Documents

An HTML document is an SGML document; that is, a sequence of characters organized physically into a set of entities, and logically as a hierarchy of elements.

In the SGML specification, the first production of the SGML syntax grammar separates an SGML document into three parts: an SGML declaration, a prologue, and an instance. For the purposes of this specification, the prologue is a DTD. This DTD describes another grammar: the start symbol is given in the doctype declaration, the terminals are data characters and tags, and the productions are determined by the element declarations. The instance must conform to the DTD, that is, it must be in the language defined by this grammar.

The SGML declaration determines the lexicon of the grammar. It specifies the document character set, which determines a character repertoire that contains all characters that occur in all text entities in the document, and the code positions associated with those characters.

The SGML declaration also specifies the syntax-reference character set of the document, and a few other parameters that bind the abstract syntax of SGML to a concrete syntax. This concrete syntax determines how the sequence of characters of the document is mapped to a sequence of terminals in the grammar of the prologue.

For example, consider the following document:

    <!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <title>Parsing Example</title>
    <p>Some text. <em>&#42;wow&#42;</em></p>

An HTML user agent should use the SGML declaration that is given in 9.5, "SGML Declaration for HTML". According to its document character set, `&#42;' refers to an asterisk character, `*'.

The instance above is regarded as the following sequence of terminals:

        1. start-tag: TITLE

        2. data characters: "Parsing Example"

        3. end-tag: TITLE

        4. start-tag: P

        5. data characters "Some text."

        6. start-tag: EM

        7. data characters: "*wow*"

        8. end-tag: EM

        9. end-tag: P

The start symbol of the DTD grammar is HTML, and the productions are given in the public text identified by `-//IETF//DTD HTML 2.0//EN' (9.1, "HTML DTD"). The terminals above parse as:

       HTML
        |
        \-HEAD
        |  |
        |  \-TITLE
        |      |
        |      \-<TITLE>
        |      |
        |      \-"Parsing Example"
        |      |
        |      \-</TITLE>
        |
        \-BODY
          |
          \-P
            |
            \-<P>
            |
            \-"Some text. "
            |
            \-EM
            |  |
            |  \-<EM>
            |  |
            |  \-"*wow*"
            |  |
            |  \-</EM>
            |
            \-</P>

Some of the elements are delimited explicitly by tags, while the boundaries of others are inferred. The <HTML> element contains a <HEAD> element and a <BODY> element. The <HEAD> contains <TITLE>, which is explicitly delimited by start- and end-tags.


Next: 3.2. HTML Lexical Syntax

Connected: An Internet Encyclopedia
3.1. SGML Documents

Cotse.Net

Protect yourself from cyberstalkers, identity thieves, and those who would snoop on you.
Stop spam from invading your inbox without losing the mail you want. We give you more control over your e-mail than any other service.
Block popups, ads, and malicious scripts while you surf the net through our anonymous proxies.
Participate in Usenet, host your web files, easily send anonymous messages, and more, much more.
All private, all encrypted, all secure, all in an easy to use service, and all for only $5.95 a month!

Service Details

 
.
www.cotse.com
Have you gone to church today?
.
All pages ©1999, 2000, 2001, 2002, 2003 Church of the Swimming Elephant unless otherwise stated
Church of the Swimming Elephant©1999, 2000, 2001, 2002, 2003 Cotse.com.
Cotse.com is a wholly owned subsidiary of Packetderm, LLC.

Packetderm, LLC
210 Park Ave #308
Worcester, MA 01609