to the main page... about these slides...

Constructing XML data

Results of a query can be wrapped in XML:
  WHERE <bib><book>
          <publisher> <name>"Addison-Wesley" </> </>
          <title>  $t </>
          <author> $a </>
        </></> IN "bib.xml"
  CONSTRUCT <result>
               <author> $a </>
               <title>  $t </>
            </>

The following example data:
  <bib>
    <book year="1995">
       <!-- A good introductory text -->
       <title>An Introduction to Database Systems </title>
       <author><lastname>Date </lastname></author>
       <publisher><name>Addison-Wesley </name> </publisher>
    </book>
    <book year="1998">
       <title>Foundation for Object/Relational Databases</title>
       <author><lastname>Date </lastname></author>
       <author><lastname>Darwen </lastname></author>
       <publisher><name>Addison-Wesley </name>  </publisher>
    </book>
  </bib>

produces the output:
  <XML>
   <result>
      <author><lastname>Date </lastname></author>
      <title>An Introduction to Database Systems </title>
   </result>
   <result>
      <author><lastname>Date </lastname></author>
      <title>Foundation for Object/Relational Databases</title>
   </result>
   <result>
      <author><lastname>Darwen </lastname></author>
      <title>Foundation for Object/Relational Databases</title>
   </result>
  </XML>