Reading a Document from the Database

Back | Home | Next

Metacat allows clients to read a document in several different ways, depending on how the client wants the document returned and how the client wants to specify the requested document.

architecture diagram of the Metacat read process

The documents are requested by the docid servlet parameter by specifying the document id that you wish to read.

Metacat allows the dynamic transformation of read documents through the use of style-sets. A style-set is an xsl stylesheet or a group of stylesheets that are specified in a config file. The following is an example of a style-set config file:

    <?xml version="1.0"?>
    <style-set name="knb">
      <default-style>http://http://server.domain.com/metacat/style/ascii-treeview.xsl</default-style>
      <doctype publicid="-//NCEAS//resultset//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/resultset.xsl</target>
      </doctype>
      <doctype publicid="-//NCEAS//login//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/login.xsl</target>
      </doctype>
      <doctype publicid="-//NCEAS//eml-dataset-2.0//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/eml-dataset-display.xsl</target>  
      </doctype>
      <doctype publicid="-//NCEAS//eml-dataset//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/eml-dataset-display.xsl</target>  
      </doctype>
      <doctype publicid="-//NCEAS//eml-resource//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/eml-dataset-display.xsl</target>  
      </doctype>      
      <doctype publicid="-//ecoinformatics.org//eml-dataset-2.0.0beta4//EN">
        <target publicid="-//W3C//HTML//EN">http://http://server.domain.com/metacat/style/eml-dataset-display.xsl</target>  
      </doctype>
    </style-set>
  

Whenever a read action is requested from Metacat, you can also provide a qformat parameter. This qformat parameter should be the name of the style-set that you wish to use to transform the document you are requesting. Note that the value that you set qformat to must equal the <style-set> name parameter.

A default style-set can be set in the metacat.properties file. If qformat is set to 'html', Metacat will use the default. If qformat is set to 'xml', Metacat will return the XML document untransformed.


Back | Home | Next