In this lab, we will use a pre-created DTD to (1) Create a Document Parser, and (2) Process a pre-written document using the generated DocumentParser to validate that our document is marked up correctly. The Document Parser will also insert any missing tags.
NOTE: These directions were written to be executed at EVITech. Mail me for advice on how to perform these steps outside of EviTech
Step 1: Let's look at the DTD. Can you see what the tags are and what the document's logical structure is? Ask if you can't!
Step 2: Let's use SGML to create a Document Parser that will recognize a document of this type:
(a) The SGML parser resides at /usr/local/share/bin. Make this directory accessible to your path by typing:
set path = ($path /usr/local/share/bin)
(b) The Document Parser you generate is huge, so let's make a new temporary directory (in "ftp space")and move to it. Type:
cd /ftp/users/ YourLoginName
mkdir /ftp/users/ YourLoginName
(c) Now copy both article.dtd and article.dc (we'll be using article.dc after we create the Document Parser). Type:
cp /users/hkunta/karenl/public_html/elecdoc/ article.dtd .
cp /users/hkunta/karenl/public_html/elecdoc/ article.dc .
(d) Change the permissions (world read and execute on both the directory and these files - ask if you don't know how)
(e)Now run SGML on this dtd to create the Document Parser. Type:
Sgml article.dtd
(f) The created Document Parser is called Article.asp. Check that it's in the directory. Even if you got an error message, it (hopefully) created the Document Parser.
Step 3 Now we'll execute Article.asp on the marked up document, article.dc.
(a)Type:
article.asp article.dc
(b) This creates a file article.out
Compare the article.dc with article.out Can you see what the difference is? If not, ask!
Send questions and comments to: Karen Lemone