Class GMLOutputTemplate

java.lang.Object
com.vividsolutions.jump.io.GMLOutputTemplate

public class GMLOutputTemplate extends Object
This class provides a parser for reading GMLOuputTemplates. This does NOT contain an evaluator for
taking the parsed GMLOutputTemplate and a featureCollection and producing properly
formatted output GML. Thats the GMLWriter class.


Most people will just use the load() function, but there is support for directly
constructing/modifying one. Your best bet for hand creating one is to make a String that
contains a GMLOutputTemplate then make a java.io.StringReader and passing it to the load()
method.
The valuators (things that look like "<%") are:
<%=GEOMETRY> - replace this with a GML represention of the geometry
<%=COLUMN <column name>> - replace this with the corresponding JCS column value
<%FEATURE> - this marks the start of a feature in the OutputTemplate
<%ENDFEATURE> - This marks the end of a feature in the OutputTempalte


Here's an example of how a simple GMLOutputTemplate is parsed by this class: for input like:
<?xml version='1.0' encoding='UTF-8'?>
<dataset...>
<schemaFeatures>
<gml:featureMember>
<% FEATURE %>
<Feature>
<featureType> <%=COLUMN featureType %> </featureType>
<property fme:name="ID"> <%=COLUMN ID %> </property>
<property fme:name="SITE"> <%=COLUMN SITE %> </property>
<property fme:name="gml2_coordsys"></property>
<gml:pointProperty>
<%=GEOMETRY %>
</gml:pointProperty>
</Feature>
<% ENDFEATURE %>
</gml:featureMember>
</dataFeatures>
</dataset>


headeText =

<?xml version='1.0' encoding='UTF-8'?>
<dataset...>
<schemaFeatures>
<gml:featureMember>

footerText =
</gml:featureMember>
</dataFeatures>
</dataset>


featureText[0] =
<Feature>
<featureType>

codingText[0] = "=COLUMN featureTtype"

featureText[1] =
</property>
<property fme:name="SITE">

codingText[1] = "=COLUMN ID"
  • Constructor Summary

    Constructors
    Constructor
    Description
    constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addItem(String header, String coding)
    for input like :
    <feature> <PROPERTY type=name> <%=NAME></property> <PROPERTY type=address> <%=ADDRESS> </property>

    use addItem("<feature> <PROPERTY type=name>","=NAME")
    addItem("</property> <PROPERTY type=address>", "%=ADDRESS")
    For debugging - return a human readable version of the parsed outputtemplate
    void
    Calls the main load() method with the stream name as "Unknown Stream"
    void
    load(Reader r, String readerName)
    Main function - parse a GMLOuputTemplate.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GMLOutputTemplate

      public GMLOutputTemplate()
      constructor
  • Method Details

    • addItem

      public void addItem(String header, String coding)
      for input like :
      <feature> <PROPERTY type=name> <%=NAME></property> <PROPERTY type=address> <%=ADDRESS> </property>

      use addItem("<feature> <PROPERTY type=name>","=NAME")
      addItem("</property> <PROPERTY type=address>", "%=ADDRESS")
    • load

      public void load(Reader r) throws Exception
      Calls the main load() method with the stream name as "Unknown Stream"
      Throws:
      Exception
    • load

      public void load(Reader r, String readerName) throws Exception
      Main function - parse a GMLOuputTemplate.
      Parameters:
      r - actual reader to read from
      readerName - name of the stream (for error reporting)
      Throws:
      Exception
    • asString

      public String asString()
      For debugging - return a human readable version of the parsed outputtemplate