System and user interface for generating structured documents

A document generator is provided, for generating structured documents on-the fly from product database. The method is based on high-level document generation specifications, which are SGML documents conformed to specification DTD. A document generator transforms document specifications and queries the product database to generate a structured SGML document. The document generator includes document generation specifications, a document structure template transformer, a document content filling operator, and a document maker.

DETAILED DESCRIPTION OF PREFERRING EMBODIMENTS The present invention provides a document generator, which implements document generation specifications for automatically creating structured documents from a database. The document specifications can be high-level SGML documents wherein the structured documents are SGML-based. The document generator includes a document structure template transformer, a document content filling operator and a document maker. The document structure template transformer takes document specifications as input, and restructures, translates and instantiates the specifications into structured document templates including placeholders for content and attributes. The document content filling operator takes the document template as input and queries the database to fill the content placeholders and attribute placeholders inside templates. The document maker takes the generated documents and publishes them as a browseable book or file. The document generator works as a specification transformer from high-level specifications into SGML structured documents. SGML document structure can be represented by an abstract data model. In the abstract data model, the model is centered around the data. The document generator can be designed for generating structured documents on-the-fly from the database, for example, a product database. The document generation specification is a formal description of the document types, structures and contents. The formal descriptions can be based on an ISO document standard, SGML, and a Document Type Definition (DTD) Specification. One of ordinary skill in the art will appreciate that other specifications can be used. Documents have a logical structure, which can be described as a tree including zero or one document type declaration node or doctype node, a root element node, and zero or more comments or processing instructions. The root element serves as the root of the element tree for the document. Referring to FIG. 1 a, the document generator queries a database for a document specification 101 and determines whether a template is available 102 . Upon determining that the template is not available, the document generator exits 103 . Upon determining that the template is present, the Document generator implements a document structure template transformer 104 , a document content filling operator 105 and a document maker 106 to generate a set of SGML documents 107 . The set of SGML documents 107 can be published as electronic book by the document maker 106 . The document structure template transformer 104 performs document node expanding and document template transformation. The document structure template transformer 104 translates document generation specifications 101 into intermediate structure templates by expanding nodes in the document specifications and transforming the structure of document specifications 101 . The document specification transformation is validated 108 to conform with the document type definition (DTD). If the document structure is not valid, the template is modified and reapplied 109 . The document structure can be validated using any commercial validating program, for example, the World Wide Web Consortium's validator service. Referring to FIG. 1 b, showing a system for generating a structured document, the system includes a processor 110 , a memory 111 , and a document generator module 112 . The document generator module 112 is connected to the database 113 . The document generator module 112 comprises a document structure template transformer module 114 , a document content filling operator module 115 and a document maker module 116 to generate at least one SGML document. An exemplary structure comprising document generation specifications with dynamically queriable <DocSpec> types is shown below. 1 < &excl; DOCTYPE DOCSPECLIST SYSTEM “partsdoc.dtd”> <DocSpecList> <Global Params> ...  (all global parameters) </GlobalParams> <Database> ...  (database connectivity parameters) <DocSpec> ...  (for one type of document, structure and placeholders) </DocSpec> <DocSpec> ...  (for another type of document, structure and placeholders) </DocSpec> <DocSpec> ...  (nth-type document) </DocSpec> </DocSpecList> An instance of the <DocSpec> shown above is given in Appendix 1. Within the document structure, content and attribute sections can include placeholders. Elements can have associated properties, called attributes or variables, which can have values. Variable-value pairs appear before the final “>” of an element's start tag. Any number of attribute value pairs, separated by spaces, may appear in an element's start tag. For example, in the document structure shown below, $ColIndex$ represents an attribute placeholder and $UI_Col_Header$ represents a content placeholder. 2 placeholder. <PartsList> <Table> <Title></Title> <TGROUP COLS&equals;“$NunOfColumnsInReport$”> <COLSPEC COLNANE&equals;“$ColIndex$” COLWIDTH&equals;“$UI_Col_Width$” Expand&equals;“$NumOfColumnsInReport$”> <THEAD VALIGN&equals;“TOP”> <ROW> <ENTRY COLNANE&equals;“$ColIndex$” MOREROWS&equals;“0” ROTATE&equals;“0” ROWSEP&equals;“0” Expand&equals;“$NumOfColumnsInReport$”> <PARA Expand &equals; “$MaxDBFieldsPerColumn$”> $UI_Col_Header$</PARA> </ENTRY> </ROW> </THEAD> <TBODY> <ROW Loop&equals;“RecordCout” Query&equals;“Q_PartsList”> <ENTRY COLNAME&equals;“$ColIndex$” MOREROWS&equals;“0” Rotate&equals;“0” Expand&equals;“$NumOfColumnsInReport$”> <PARA Expand &equals; “$MaxDBFieldsPerColumn$”> $UI_Col_Header$</PARA> </ENTRY> </ROW> </TBODY> </TGROUP> </Table> <PartsList> FIG. 2 a illustrates a method of document node expanding and document template transformation. The method performs a search sequence (shown in FIG. 2 a ), parsing the structure of the document 201 , identifying variable-value pairs 202 , determining whether a match exists between a given variable and a value 203 , replacing variable-value pairs 204 , and determining whether the set of the variable-value pairs have been checked 205 . Upon determining that a mismatch exists between a variable-value pair, the method searches sibling and parent nodes for a match 206 . The document structure template transformation checks attributes for further structure expanding in templates. If there are directives provided for the processor to expand the structure, then the method iterates through the structure 207 and creates an exact replica of nodes based on the skeletal structure 208 . For example, 3 <COLSPEC COL&equals;“$ColIndex$” COLWIDTH&equals;“$UI_Col_Width$” Expand&equals;“$NumOfColumnsInReport$”> If “$NumOfColumnsInReport$” &equals; 3 then, “$ColIndex$” is set to 3 Structure becomes <Colspec Col&equals;“1” COLWIDTH&equals;“$UI_Col_Width$” Expand&equals;“3”> <Colspec Col&equals;“2” COLWIDTH&equals;“$UI_Col_Width$” Expand&equals;“3”> <Colspec Col&equals;“3” COLWIDTH&equals;“$UI_Col_Width$” Expand&equals;“3”> “$UI_Col_Width$” values for each of the <Colspec> values come from GUI (input by the user) The Variable Names can be replaced with Values. The values determined from, for example, defaults designated in the <DefineVar>; directives issued to read registry/environment variables; and comes from the database. For example, the “$MachineSpec$” variable(see Appendix 1) in the attribute value nodes and queries is replace with the value “800336” coming from the <GlobalVar> section. As shown in FIG. 2 b, replacement follows a search sequence that traverses the tree structure up a hierarchy tree. The hierarchy tree can include, for example, at a low level the content 221 , a <DocSpec> level variable 222 , and at a high level, the global variables 223 . The document content filling operator 105 ( FIG. 1 a ) examines the intermediate document structure template using a document tree walking procedure to determine all placeholders, including document element attributes, and content, and retrieve the document content and attributes from product database 110 to fill the placeholders for content and attributes. Referring to FIG. 3 , the document tree walking process marks the Variable Nodes for Content Filling 301 . The variables can be replaced with values in the form of a database field, if a variable is not replaced, then it can be marked for deletion 208 ( FIG. 2 a ). The method validates the replacement against the DTD 302 ( FIG. 3 ) to ensure the correctness of the structure. For example, given an expanded structure, such as the example given above, generated during a document template transformation, a variable “$UI_Col_Content$” can be replaced with a value such as a database column name, e.g., “$PartNumber$”. The value “$PartNumber$” happens to be a field name in the database table that is being queried. Node pair values can be removed 202 ( FIG. 2 a ). Within the database 304 , the document content filling operator 115 (see FIG. 1 b ) looks for these database column names in the structure, and queries the table for values 305 one row at a time 306 so long as no value exists. Upon determining a value, the method retrieves a corresponding pair of values 307 . A variable placeholder can then be replaced 308 . According to an embodiment of the present invention, a user interface can be provided, including a plurality of dialog boxes or windows. FIG. 4 is an illustrative example including, inter alia, a global variable dialog box 401 for accepting a machine number, a description of the document, a language, target directories including a SGML base directory, etc. Other types of input and output interfaces can include, a database variable dialog box 402 , a main viewer 403 , an output message window 404 , and a document layout variable dialog box 405 for modifying, inter alia, margins widths and column headings. Once a document has been rendered, for example an SGML document, the document can be presented in any suitable browser. For example, a Dynatext® Browser as shown in FIG. 5 , wherein a document tree 501 is included for browsing the document. Having described embodiments for a system and method of generating a structured document, it is noted that modifications and variations can be made by persons skilled in the art in light of the above teachings. It is therefore to be understood that changes may be made in the particular embodiments of the invention disclosed which are within the scope and spirit of the invention as defined by the appended claims. Having thus described the invention with the details and particularity required by the patent laws, what is claimed and desired protected by Letters Patent is set forth in the appended claims. 4 Appendix 1. <DocSpec> <DefineVar Name&equals;“$PartsList$”> <&excl; &lsqb; CDATA &lsqb;Gas Turbine Spare Parts&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$Heading1$”> <&excl; &lsqb; CDATA &lsqb;Gas Turbine&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$Q_ComponentList$”&rsqb; &rsqb;> <&excl; &lsqb; CDATA &lsqb;Select distinct komponents, aufnr from $ViewName1$ where aufnr &equals; ′$MachineSpec$′&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$QueryStringForViewName3$”> <&excl; &lsqb; CDATA &lsqb;select * from $ViewName&num;$&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$UserDefinedQuery1$”> <&excl; &lsqb; CDATA &lsqb;select distinct component, notation_e from v_tac_36 where tnr &equals; ′$MachineSpec$′&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$NumOfColumnsInReports$”> <&excl; &lsqb; CDATA &lsqb;7&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$PageLayoutUnits$”> <&excl; &lsqb; CDATA &lsqb;cm&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$PageLayouts$”> <&excl; &lsqb; CDATA &lsqb;2&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$LeftMargins$”> <&excl; &lsqb; CDATA &lsqb;2&rsqb; &rsqb;> </DefineVar> <DefineVar Name&equals;“$RightMargins$”> <&excl; &lsqb; CDATA &lsqb;1.25&rsqb; &rsqb;> </DefineVar> <GroupParts Loop&plus;“RecordCount” Query&plus;“Q_ComponentLost” CreateFile&equals;“Multiple”> <DocHeader ID&equals;“N$CornponentList$” File&plus;“3.6.2- $ComponetList$.sgm”> <MachineType>$Heading1$</MachingeType> <DocType>$Heading3$</DocType> <DocSuperType>$Heading2$</DocSuperType> <DocDesc>$Headings4$</DocDesc> <MachineSubtype></MachingeSubType> <MoreDocDesc>$Heading5$</MoreDocDesc> </DocHeader> <PartsList> <Table> <Title></Title> <TGROUP COLS&equals;$NumOfColumnsInReports$”> <COLSPEC COLNAME&equals;“$ColIndex$” COLWIDTH&equals;“SUI_Col_Width$” Expand&equals;“$NumOfColumnsInReport$”> <THREAD VALIGN&equals;“TOP”> <ROW> <ENTRY COLNAME&equals;“$ColIndex$” MOREROWS&equals;“0” ROTATE&equals;“0” ROWSEP&equals;“0” Expand&equals;“$NumOfColumnsInReport$”> </ENTRY> </ROW> </THREAD> <TBODY> <ROW Loop&equals;“RecordCount” Query&equals;“Q_PartsList”> <ENTRY COLNAME&equals;“$ColIndex$” MOREROWS&equals;“0” ROTATE&equals;“0” ROWSEP&equals;“0” Expand&equals;“$NumOfColumnsInReport$”> </ENTRY> </ROW> </TBODY> </TGROUP> <Table> <PartsList> <DocFooter> <CompanyLabel>$CompanyLabels$</CompanyLabel> <Docnum>3.6.2-$ComponentList$</Docnum> <DivisionLabel>$DivisionLabel$</DivisionLabel> <DocDate>$Date$</DocDate> </DocFooter> <GroupParts> <DocSpec>