Class 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 > - 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 Detail

      • GMLOutputTemplate

        public GMLOutputTemplate()
        constructor
    • Method Detail

      • setHeaderText

        public void setHeaderText​(String text)
        sets the HeaderText for the Outputtemplate
      • setFooterText

        public void setFooterText​(String text)
        sets the FooterText for the Outputtemplate
      • setFeatureFooter

        public void setFeatureFooter​(String text)
        sets the Footer text for the bottom of the feature
      • 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