org.deegree.gml
Class GMLStreamWriter

java.lang.Object
  extended by org.deegree.gml.GMLStreamWriter

public class GMLStreamWriter
extends java.lang.Object

Stream-based writer for GML instance documents or GML fragments.

Instances of this class are not thread-safe.

Version:
$Revision: 27148 $, $Date: 2010-10-03 18:22:46 +0200 (So, 03. Okt 2010) $
Author:
Markus Schneider, last edited by: $Author: mschneider $
See Also:
GMLObject, GMLOutputFactory

Method Summary
 void close()
          Closes the underlying XML stream.
 javax.xml.stream.XMLStreamWriter getXMLStream()
          Returns the underlying XML stream.
 boolean isObjectExported(java.lang.String gmlId)
          Returns whether the specified gml object has already been exported.
 void setAdditionalObjectHandler(AdditionalObjectHandler handler)
           
 void setCoordinateFormatter(CoordinateFormatter formatter)
          Controls the format (e.g. number of decimal places) for written coordinates.
 void setFeatureProperties(PropertyName[] featureProps)
          Sets the feature properties to be included for exported Feature instances.
 void setIndentation(java.lang.String indentString)
          Controls the indentation of the generated XML.
 void setLocalXLinkTemplate(java.lang.String localXLinkTemplate)
          Controls the representation of local xlinks.
 void setNamespaceBindings(java.util.Map<java.lang.String,java.lang.String> prefixToNs)
          Controls the namespace prefixes that are used whenever a qualified element or attribute is written (and no namespace prefix has been bound on the stream).
 void setOutputCRS(CRS crs)
          Controls the output CRS for written geometries.
 void setSchemaLocation(java.lang.String schemaLocation)
          Controls the value of the xsi:schemaLocation attribute in the root element.
 void setXLinkDepth(int inlineXLinklevels)
          Controls the number of xlink levels that will be expanded inside property elements.
 void setXLinkExpiry(int traverseXLinkExpiry)
          Controls the number number of seconds to wait when remote xlinks are expanded inside property elements.
 void setXLinkFeatureProperties(XLinkPropertyName[] xlinkProps)
          Sets a specific XLink-expansion behaviour for object properties (e.g.
 void write(Definition definition)
          Writes a GML representation of the given Definition to the stream.
 void write(Feature feature)
          Writes a GML representation of the given Feature to the stream.
 void write(Geometry geometry)
          Writes a GML representation of the given Geometry to the stream.
 void write(GMLObject object)
          Writes a GML representation of the given GMLObject to the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setSchemaLocation

public void setSchemaLocation(java.lang.String schemaLocation)
Controls the value of the xsi:schemaLocation attribute in the root element.

Parameters:
schemaLocation - value to be exported in the xsi:schemaLocation attribute in the root element, or null (no xsi:schemaLocation attribute will be exported)

setIndentation

public void setIndentation(java.lang.String indentString)
Controls the indentation of the generated XML.

Parameters:
indentString - string to be used for one level of indentation (must be some combination of whitespaces), can be null (turns off indentation)

setOutputCRS

public void setOutputCRS(CRS crs)
Controls the output CRS for written geometries.

Parameters:
crs - crs to be used for the geometries, can be null (keeps the original CRS)

setCoordinateFormatter

public void setCoordinateFormatter(CoordinateFormatter formatter)
Controls the format (e.g. number of decimal places) for written coordinates.

Parameters:
formatter - formatter to use, may be null (don't do any formatting)

setNamespaceBindings

public void setNamespaceBindings(java.util.Map<java.lang.String,java.lang.String> prefixToNs)
Controls the namespace prefixes that are used whenever a qualified element or attribute is written (and no namespace prefix has been bound on the stream).

Parameters:
prefixToNs - keys: prefix, value: namespace, may be null

setXLinkDepth

public void setXLinkDepth(int inlineXLinklevels)
Controls the number of xlink levels that will be expanded inside property elements.

Parameters:
inlineXLinklevels - number of xlink levels to be expanded, -1 expands to any depth

setXLinkExpiry

public void setXLinkExpiry(int traverseXLinkExpiry)
Controls the number number of seconds to wait when remote xlinks are expanded inside property elements.

Parameters:
traverseXLinkExpiry - number of seconds to wait for the resolving of remote xlinks, -1 sets no timeout

setLocalXLinkTemplate

public void setLocalXLinkTemplate(java.lang.String localXLinkTemplate)
Controls the representation of local xlinks.

Parameters:
localXLinkTemplate - template used to create references to local objects, e.g. http://localhost:8080/d3_wfs_lab/services?SERVICE=WFS&REQUEST=GetGmlObject&VERSION=1.1.0&TRAVERSEXLINKDEPTH=1&GMLOBJECTID={} , the substring {} is replaced by the object id

setFeatureProperties

public void setFeatureProperties(PropertyName[] featureProps)
Sets the feature properties to be included for exported Feature instances.

Parameters:
featureProps - feature properties to be included, or null (include all feature props)

setXLinkFeatureProperties

public void setXLinkFeatureProperties(XLinkPropertyName[] xlinkProps)
Sets a specific XLink-expansion behaviour for object properties (e.g. Feature or Geometry properties).

Parameters:
xlinkProps - XLink-behaviour information, or null (no property-specific xlink behaviour)

setAdditionalObjectHandler

public void setAdditionalObjectHandler(AdditionalObjectHandler handler)

isObjectExported

public boolean isObjectExported(java.lang.String gmlId)
Returns whether the specified gml object has already been exported.

Parameters:
gmlId - id of the object, must not be null
Returns:
true, if the object has been exported, false otherwise

write

public void write(GMLObject object)
           throws javax.xml.stream.XMLStreamException,
                  UnknownCRSException,
                  TransformationException
Writes a GML representation of the given GMLObject to the stream.

Parameters:
object - object to be written, must not be null
Throws:
javax.xml.stream.XMLStreamException
UnknownCRSException
TransformationException

write

public void write(Feature feature)
           throws javax.xml.stream.XMLStreamException,
                  UnknownCRSException,
                  TransformationException
Writes a GML representation of the given Feature to the stream.

Parameters:
feature - object to be written, must not be null
Throws:
javax.xml.stream.XMLStreamException
UnknownCRSException
TransformationException

write

public void write(Geometry geometry)
           throws javax.xml.stream.XMLStreamException,
                  UnknownCRSException,
                  TransformationException
Writes a GML representation of the given Geometry to the stream.

Parameters:
geometry - object to be written, must not be null
Throws:
javax.xml.stream.XMLStreamException
UnknownCRSException
TransformationException

write

public void write(Definition definition)
           throws javax.xml.stream.XMLStreamException
Writes a GML representation of the given Definition to the stream.

Parameters:
definition - object to be written, must not be null
Throws:
javax.xml.stream.XMLStreamException

close

public void close()
           throws javax.xml.stream.XMLStreamException
Closes the underlying XML stream.

Throws:
javax.xml.stream.XMLStreamException

getXMLStream

public javax.xml.stream.XMLStreamWriter getXMLStream()
Returns the underlying XML stream.

Returns:
the underlying XML stream, never null


Copyright © 2011. All Rights Reserved.