deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.model.feature
Class GMLFeatureDocument

java.lang.Object
  extended by org.deegree.framework.xml.XMLFragment
      extended by org.deegree.ogcbase.GMLDocument
          extended by org.deegree.model.feature.GMLFeatureDocument
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
GMLFeatureCollectionDocument

public class GMLFeatureDocument
extends GMLDocument

Parser and wrapper class for GML feature documents.

Validation
Has validation capabilities: if the schema is provided or the document contains a reference to a schema the structure of the generated features is checked. If no schema information is available, feature + property types are heuristically determined from the feature instance in the document (guessing of simple property types can be turned off, because it may cause unwanted effects).

XLinks
Has some basic understanding of XLink: Supports internal XLinks (i.e. the content for a feature is given by a reference to a feature element in the same document). No support for external XLinks yet.

Propagation of srsName attribute

Version:
$Revision: 27360 $, $Date: 2010-10-18 20:37:37 +0200 (Mo, 18 Okt 2010) $
Author:
Markus Schneider , last edited by: $Author: apoth $
See Also:
Serialized Form

Field Summary
protected  java.util.Map<java.lang.String,Feature> featureMap
           
protected  java.util.Map<java.net.URI,GMLSchema> gmlSchemaMap
           
protected  java.util.Collection<XLinkedFeatureProperty> xlinkPropertyList
           
 
Fields inherited from class org.deegree.framework.xml.XMLFragment
DEFAULT_URL, nsContext, XLNNS
 
Constructor Summary
GMLFeatureDocument()
          Creates a new instance of GMLFeatureDocument.
GMLFeatureDocument(boolean guessSimpleTypes)
          Creates a new instance of GMLFeatureDocument.
 
Method Summary
protected  FeatureType getFeatureType(QualifiedName ftName)
          Returns the feature type with the given name.
protected  java.util.Map<java.net.URI,GMLSchema> getGMLSchemas()
          Determines and retrieves the GML schemas that the document refers to.
protected  GMLSchema getSchemaForNamespace(java.net.URI ns)
          Returns the GML schema for the given namespace.
 Feature parseFeature()
          Returns the object representation for the root feature element.
protected  Feature parseFeature(org.w3c.dom.Element element)
          Returns the object representation for the given feature element.
protected  Feature parseFeature(org.w3c.dom.Element element, java.lang.String srsName)
          Returns the object representation for the given feature element.
 Feature parseFeature(java.lang.String defaultSRS)
          Returns the object representation for the root feature element.
protected  java.lang.String parseFeatureId(org.w3c.dom.Element featureElement)
          Parses the feature id attribute from the given feature element.
 FeatureProperty parseProperty(org.w3c.dom.Element propertyElement, FeatureType ft)
          Returns the object representation for the given property element.
 FeatureProperty parseProperty(org.w3c.dom.Element propertyElement, FeatureType ft, java.lang.String srsName)
          Returns the object representation for the given property element.
protected  void resolveXLinkReferences()
           
 void setSchemas(java.util.Map<java.net.URI,GMLSchema> gmlSchemaMap)
          Explicitly sets the GML schema information that the document must comply to.
 
Methods inherited from class org.deegree.ogcbase.GMLDocument
parseEnvelope, parseGrid, parsePos, parseTimePosition
 
Methods inherited from class org.deegree.framework.xml.XMLFragment
getAsPrettyString, getAsString, getAttachedSchemas, getQualifiedName, getRootElement, getSystemId, hasSchema, load, load, load, parseQualifiedName, parseSimpleLink, prettyPrint, prettyPrint, resolve, setRootElement, setSystemId, setSystemId, toString, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gmlSchemaMap

protected java.util.Map<java.net.URI,GMLSchema> gmlSchemaMap

featureMap

protected java.util.Map<java.lang.String,Feature> featureMap

xlinkPropertyList

protected java.util.Collection<XLinkedFeatureProperty> xlinkPropertyList
Constructor Detail

GMLFeatureDocument

public GMLFeatureDocument()
Creates a new instance of GMLFeatureDocument.

Simple types encountered during parsing are "guessed", i.e. the parser tries to convert the values to double, integer, calendar, etc. However, this may lead to unwanted results, e.g. a property value of "054604" is converted to "54604".


GMLFeatureDocument

public GMLFeatureDocument(boolean guessSimpleTypes)
Creates a new instance of GMLFeatureDocument.

Parameters:
guessSimpleTypes - set to true, if simple types should be "guessed" during parsing
Method Detail

setSchemas

public void setSchemas(java.util.Map<java.net.URI,GMLSchema> gmlSchemaMap)
Explicitly sets the GML schema information that the document must comply to.

This overrides any schema information that the document refers to.

Parameters:
gmlSchemaMap - key: namespace URI, value: GMLSchema

parseFeature

public Feature parseFeature()
                     throws XMLParsingException,
                            UnknownCRSException
Returns the object representation for the root feature element.

Returns:
object representation for the root feature element.
Throws:
XMLParsingException
UnknownCRSException

parseFeature

public Feature parseFeature(java.lang.String defaultSRS)
                     throws XMLParsingException,
                            UnknownCRSException
Returns the object representation for the root feature element.

Parameters:
defaultSRS - default SRS for all a descendant geometry properties
Returns:
object representation for the root feature element.
Throws:
XMLParsingException
UnknownCRSException

parseFeature

protected Feature parseFeature(org.w3c.dom.Element element)
                        throws XMLParsingException,
                               UnknownCRSException
Returns the object representation for the given feature element.

Parameters:
element - feature element
Returns:
object representation for the given feature element.
Throws:
XMLParsingException
UnknownCRSException

parseFeature

protected Feature parseFeature(org.w3c.dom.Element element,
                               java.lang.String srsName)
                        throws XMLParsingException,
                               UnknownCRSException
Returns the object representation for the given feature element.

Parameters:
element - feature element
srsName - default SRS for all descendant geometry properties
Returns:
object representation for the given feature element
Throws:
XMLParsingException
UnknownCRSException

parseProperty

public FeatureProperty parseProperty(org.w3c.dom.Element propertyElement,
                                     FeatureType ft)
                              throws XMLParsingException,
                                     UnknownCRSException
Returns the object representation for the given property element.

Parameters:
propertyElement - property element
ft - feature type of the feature that the property belongs to
Returns:
object representation for the given property element
Throws:
XMLParsingException
UnknownCRSException

parseProperty

public FeatureProperty parseProperty(org.w3c.dom.Element propertyElement,
                                     FeatureType ft,
                                     java.lang.String srsName)
                              throws XMLParsingException,
                                     UnknownCRSException
Returns the object representation for the given property element.

Parameters:
propertyElement - property element
ft - feature type of the feature that the property belongs to
srsName - default SRS for all a descendant geometry properties
Returns:
object representation for the given property element.
Throws:
XMLParsingException
UnknownCRSException

resolveXLinkReferences

protected void resolveXLinkReferences()
                               throws XMLParsingException
Throws:
XMLParsingException

getGMLSchemas

protected java.util.Map<java.net.URI,GMLSchema> getGMLSchemas()
                                                       throws XMLParsingException,
                                                              UnknownCRSException
Determines and retrieves the GML schemas that the document refers to.

Returns:
the GML schemas that are attached to the document, keys are URIs (namespaces), values are GMLSchemas.
Throws:
XMLParsingException
UnknownCRSException

getSchemaForNamespace

protected GMLSchema getSchemaForNamespace(java.net.URI ns)
                                   throws XMLParsingException,
                                          UnknownCRSException
Returns the GML schema for the given namespace.

Parameters:
ns -
Returns:
the GML schema for the given namespace if it is declared, null otherwise.
Throws:
XMLParsingException
UnknownCRSException

getFeatureType

protected FeatureType getFeatureType(QualifiedName ftName)
                              throws XMLParsingException,
                                     UnknownCRSException
Returns the feature type with the given name.

If schema information is available and a feature type with the given name is not defined, an XMLParsingException is thrown.

Parameters:
ftName - feature type to look up
Returns:
the feature type with the given name if it is declared, null otherwise.
Throws:
XMLParsingException
UnknownCRSException

parseFeatureId

protected java.lang.String parseFeatureId(org.w3c.dom.Element featureElement)
Parses the feature id attribute from the given feature element.

Looks after 'gml:id' (GML 3 style) first, if no such attribute is present, the 'fid' (GML 2 style) attribute is used.

Parameters:
featureElement -
Returns:
the feature id, this is "" if neither a 'gml:id' nor a 'fid' attribute is present

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org