com.vividsolutions.jump.io
Class GMLOutputTemplate

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

public class GMLOutputTemplate
extends java.lang.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 > - 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
GMLOutputTemplate()
          constructor
 
Method Summary
 void addItem(java.lang.String header, java.lang.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")
 java.lang.String asString()
          For debugging - return a human readable version of the parsed outputtemplate
 void load(java.io.Reader r)
          Calls the main load() method with the stream name as "Unknown Stream"
 void load(java.io.Reader r, java.lang.String readerName)
          Main function - parse a GMLOuputTemplate.
 void setFeatureFooter(java.lang.String text)
          sets the Footer text for the bottom of the feature
 void setFooterText(java.lang.String text)
          sets the FooterText for the Outputtemplate
 void setHeaderText(java.lang.String text)
          sets the HeaderText for the Outputtemplate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GMLOutputTemplate

public GMLOutputTemplate()
constructor

Method Detail

setHeaderText

public void setHeaderText(java.lang.String text)
sets the HeaderText for the Outputtemplate


setFooterText

public void setFooterText(java.lang.String text)
sets the FooterText for the Outputtemplate


setFeatureFooter

public void setFeatureFooter(java.lang.String text)
sets the Footer text for the bottom of the feature


addItem

public void addItem(java.lang.String header,
                    java.lang.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(java.io.Reader r)
          throws java.lang.Exception
Calls the main load() method with the stream name as "Unknown Stream"

Throws:
java.lang.Exception

load

public void load(java.io.Reader r,
                 java.lang.String readerName)
          throws java.lang.Exception
Main function - parse a GMLOuputTemplate.

Parameters:
r - actual reader to read from
readerName - name of the stream (for error reporting)
Throws:
java.lang.Exception

asString

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