CIS 97YT Index > Assignment 3

Assignment 3
Creating and Using an RNG File

Read everything before doing anything.

The objects of this assignment are:

See instructor's sample files
See a note about <interleave>
See a solution allowing nested <ul>
See a solution not allowing nested <ul>

Specification of the Language

The catalog example used in part two of Assignment 1 had no specification for its “grammar.” Here is an English-language description of that grammar, which you should turn into an RNG specification. We've expanded upon it to use features of RNG that aren't available in a DTD. New information has a vertical bar at the side.

See why color specifications are set up this way.

HTML Subset

First, we define inline elements as the <em> and <strong> elements, which may contain text and other inline elements. Given that definition, the <summary> and <description> elements may contain:

Notice that this is a highly recursive definition. Here's an example of a valid <description>

<description xmlns:xh="http://www.w3.org/1999/xhtml">
The <xh:strong><xh:em>Sup-R Frying Pan</xh:em></xh:strong> is such a deal!
<xh:p>
Made of <xh:strong>heavy-duty</xh:strong> aluminum alloy, it assists
food preparation with:
</xh:p>
<xh:ul>
<xh:li>A non-conductive handle.</xh:li>
<xh:li><xh:p>Non-stick coating</xh:p> (it's vitamin-enriched, too!)</xh:li>
</xh:ul>
<xh:p>Buy one <xh:em>right now!</xh:em></xh:p>
</description>

Please use namespaces to implement this subset of XHTML, as in the example above. The namespace URI for XHTML is http://www.w3.org/1999/xhtml.

You will also need to produce mixed content with <interleave>. See information about a problem you might encounter.

Note: You will want to add some of this XHTML to your file to test that your RNG file handles it properly. I will test your RNG against one of my own sample files.

Naming Your Files

Your files should be saved as plain ASCII text, but that does not mean that they must both end with the extension .txt. If your name is Joe Doakes, your RNG file should have a name like doakes_j_3.rng and the XML file should have a name like doakes_j_3.xml. You may remove the <!DOCTYPE> from the XML file, as it is no longer needed.

Checking Your Work

Use the msvalidate.bat file on Windows, or msvalidate.sh shell script on Unix/Linux. The validator will give no error messages if everything is OK. If you've named your files as shown above, you would type:

msvalidate doakes_j_3.rng doakes_j_3.xml