Search in sources :

Example 1 with ApplicationSchemaConfiguration

use of org.geotools.gml3.ApplicationSchemaConfiguration in project coastal-hazards by USGS-CIDA.

the class GMLUtil method generateGMLConfiguration.

public static Configuration generateGMLConfiguration(InputStream inputStream) {
    QName featureTypeSchema = GMLUtil.extractFeatureTypeSchema(inputStream);
    if (featureTypeSchema == null) {
        throw new RuntimeException("featureTypeSchema null for inputStream");
    }
    String schemaLocation = featureTypeSchema.getLocalPart();
    Configuration configuration = null;
    if (schemaLocation != null && featureTypeSchema.getNamespaceURI() != null) {
        SchemaRepository.registerSchemaLocation(featureTypeSchema.getNamespaceURI(), schemaLocation);
        configuration = new ApplicationSchemaConfiguration(featureTypeSchema.getNamespaceURI(), schemaLocation);
    } else {
        configuration = new GMLConfiguration();
        configuration.getProperties().add(Parser.Properties.IGNORE_SCHEMA_LOCATION);
        configuration.getProperties().add(Parser.Properties.PARSE_UNKNOWN_ELEMENTS);
    }
    return configuration;
}
Also used : GMLConfiguration(org.geotools.gml3.GMLConfiguration) Configuration(org.geotools.xml.Configuration) ApplicationSchemaConfiguration(org.geotools.gml3.ApplicationSchemaConfiguration) QName(javax.xml.namespace.QName) ApplicationSchemaConfiguration(org.geotools.gml3.ApplicationSchemaConfiguration) GMLConfiguration(org.geotools.gml3.GMLConfiguration)

Example 2 with ApplicationSchemaConfiguration

use of org.geotools.gml3.ApplicationSchemaConfiguration in project coastal-hazards by USGS-CIDA.

the class GMLUtil method generateGMLConfiguration.

public static Configuration generateGMLConfiguration(InputStream inputStream) {
    QName featureTypeSchema = GMLUtil.extractFeatureTypeSchema(inputStream);
    if (featureTypeSchema == null) {
        throw new RuntimeException("featureTypeSchema null for inputStream");
    }
    String schemaLocation = featureTypeSchema.getLocalPart();
    Configuration configuration = null;
    if (schemaLocation != null && featureTypeSchema.getNamespaceURI() != null) {
        configuration = new ApplicationSchemaConfiguration(featureTypeSchema.getNamespaceURI(), schemaLocation);
    } else {
        configuration = new GMLConfiguration();
        configuration.getProperties().add(Parser.Properties.IGNORE_SCHEMA_LOCATION);
        configuration.getProperties().add(Parser.Properties.PARSE_UNKNOWN_ELEMENTS);
    }
    return configuration;
}
Also used : GMLConfiguration(org.geotools.gml3.GMLConfiguration) Configuration(org.geotools.xml.Configuration) ApplicationSchemaConfiguration(org.geotools.gml3.ApplicationSchemaConfiguration) QName(javax.xml.namespace.QName) ApplicationSchemaConfiguration(org.geotools.gml3.ApplicationSchemaConfiguration) GMLConfiguration(org.geotools.gml3.GMLConfiguration)

Aggregations

QName (javax.xml.namespace.QName)2 ApplicationSchemaConfiguration (org.geotools.gml3.ApplicationSchemaConfiguration)2 GMLConfiguration (org.geotools.gml3.GMLConfiguration)2 Configuration (org.geotools.xml.Configuration)2