<%@ LANGUAGE=JScript %>
<HTML>
<HEAD></HEAD>
<BODY>
   <% 
   
     var xmlDocument =
        Server.CreateObject("MSXML2.DOMDocument");

    documentType = "dtd/" + Request.Form("dtdtype") + ".dtd";

    headline = Request.Form("T1");
    deck = Request.Form("T2");
    byline = Request.Form("T3");
    pubDate = Request.Form("T4");
    authorTxt = Request.Form("T5");

    prolog = "<?xml version='1.0' standalone='yes' ?>\n";
    dtdLocalPath = Server.MapPath(documentType);
    docTypeDecl = "<!DOCTYPE article SYSTEM '" +
      dtdLocalPath + "'>" + "\n";
    rootOpen = "<article>\n";
    rootClose = "</article>";

    xmlStr = prolog + docTypeDecl + rootOpen +
      "<logo href='/rocket/images/logo.gif' />\n" +
      "<blackoutLogo href='/rocket/images/blackoutLogo.gif' />\n";

    xmlStr = xmlStr + "<headline>" + headline + "</headline>\n" +
      "<deck>" + deck + "</deck>\n" +
      "<byline>" + byline + "</byline>\n" +
      "<pubDate>" + pubDate + "</pubDate>\n" +
      "<aBody>" + authorTxt + "</aBody>\n" + 
      "<copyright>Copyright (c) 1999-2000, Michael Floyd. " +
      "All Rights Reserved</copyright>\n" +
      rootClose;

    xmlDocument.validateOnParse = true;
    xmlDocument.loadXML(xmlStr);
    if (xmlDocument.parseError.errorCode != 0) {
       returnStr = "Parse Error: " +
         xmlDocument.parseError.reason + "<BR>" +
         "occurred at line: " + xmlDocument.parseError.line +
         "<BR>" +
         "--------------------------<BR>" +
         "source: " + xmlDocument.parseError.srcText;
    } else {
       saveFile = Server.MapPath(Request.Form("filename"));
       xmlDocument.save(saveFile);
       returnStr = "The document " + saveFile +
       " has been validated and stored on the system";
    }

     Response.Write(returnStr + "\n");
     
    %>

</BODY>
</HTML>