Code generator SAAT

A simple SAAT-based source code generator is integrated into the SNAT-based source code generator described in the section called “Code generator SNAT”. Currently, the metadata model is restricted to alignments (@al attributes), and alignment qualifiers are not yet supported. Behind the scenes, code generation is based on a transformation of the supplied SAAT document into a SNAT document. Let target documents of the desired transformation code have a root element <publications> and be described by an XSD publications.xsd. An initial version of a SAAT document is generated by the following call:

   basex –b "request=saat?xsd=/a/b/c/publications.xsd,
                          ename=publications" 
         –o publications.saat.xml  
   $HOME_XSDPLUS/xsdplus.xq

After editing the SAAT document, the transformation code (publications.xq) is generated:

   basex –b "request=saat2xq?saat=publications.saat.xml" 
         –o publications.xq  
   $HOME_XSDPLUS/xsdplus.xq

Given a set of input documents (e.g. books.xml), the transformer can be tested, creating a target document publications.xml:

   basex –i books.xml –o publications.xml publications.xq

After changes of the XSD, the SAAT document must be upgraded. After renaming the current SAAT document (e.g. to publications.saat.v100.xml), this is achieved by the following command:

   basex –b "request=saat?xsd=/a/b/c/publications.xsd,
                          ename=publications, 
                          upgrade=publications.saat.v100.xml"                
         –o publications.saat.xml  
   $HOME_XSDPLUS/xsdplus.xq

Like an upgraded SNAT document, an upgraded SAAT document must usually be hand-edited in order to supply the settings required for new element and attributes.