Hi List,

I've been trying to parse some gml (3.2) files into a SimpleFeatureCollection, but it fails (it returns a hashmap). I've got the XSD's locally, but it can't seem to find the imported one (which is the GML definition). My parser configuration:

Hints.putSystemDefault(Hints.ENTITY_RESOLVER, NullEntityResolver.INSTANCE);
Hints.scanSystemProperties();

final String schemaLocation = 
TOP250NLParser.class.getResource("top250nl_resolved.xsd").toString();
Configuration topNLConfig = new 
ApplicationSchemaConfiguration("http://register.geostandaarden.nl/gmlapplicatieschema/top250nl/1.2.0";,
 schemaLocation);

parser = new Parser(topNLConfig);
parser.setEntityResolver( GeoTools.getEntityResolver(GeoTools.getDefaultHints() 
) );
parser.setValidating(false);
parser.setStrict(false);
parser.setFailOnValidationError(false);


This local xsd (https://github.com/mtoonen/topparser/blob/master/src/main/resources/org/geotools/xml/top250nl_resolved.xsd) has several imports:

   <import 
namespace="http://register.geostandaarden.nl/gmlapplicatieschema/brt-algemeen/1.2.0";   
schemaLocation="brt-algemeen_resolved.xsd"/>

   <import namespace="http://www.opengis.net/gml/3.2";  
schemaLocation="gml_resolved.xsd"/>


which are in the same directory (https://github.com/mtoonen/topparser/tree/master/src/main/resources/org/geotools/xml) as the top250nl_resolved.xsd, but it can't load them.

The logs show:


org.geotools.xml TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - 
startElement(http://register.geostandaarden.nl/gmlapplicatieschema/top250nl/1.2.0,FeatureCollectionT250NL,top250nl:FeatureCollectionT250NL

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#finer:135) - No schemaLocation found, 
using 'http://register.geostandaarden.nl/gmlapplicatieschema/top250nl/1.2.0 
file:/home/meine/dev/topparser/target/classes/org/geotools/xml/top250nl_resolved.xsd

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#fine:134) - building schema for 
schema: http://register.geostandaarden.nl/gmlapplicatieschema/top250nl/1.2.0

org.geotools.factory TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - ENTRY  (FilterFactory, 
FILTER_FACTORY)

org.geotools.factory TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - CHECK  (FilterFactory, 
FILTER_FACTORY): user provided a Class.

org.geotools.factory TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - CHECK  (FilterFactory, 
FILTER_FACTORY): consider hint[last] FilterFactory2.

org.geotools.util TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - Rehash from 7 to 13

org.geotools.resources DEBUG 08:58:00 (org.geotools.util.logging.CommonsLogger#finer:135) 
- Loaded resources for English from bundle "org.geotools.resources.i18n".

org.geotools.factory  INFO 08:58:00 
(org.geotools.util.logging.CommonsLogger#config:133) - Factory implementations 
for category FilterFactory:

  org.geotools.filter.FilterFactoryImpl

org.geotools.factory TRACE 08:58:00 
(org.geotools.util.logging.CommonsLogger#finest:136) - RETURN (FilterFactory, 
FILTER_FACTORY): found implementation FilterFactoryImpl.

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#fine:134) - Could not locate schema 
for: gml_resolved.xsd.

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#fine:134) - building schema for 
schema: http://www.w3.org/1999/xlink

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#fine:134) - Could not locate schema 
for: brt-algemeen_resolved.xsd.

org.geotools.xml DEBUG 08:58:00 
(org.geotools.util.logging.CommonsLogger#fine:134) - Could not locate schema 
for: gml_resolved.xsd.


The xml which I'm trying to parse: https://github.com/mtoonen/topparser/blob/master/src/test/resources/org/geotools/xml/FunctioneelGebied.xml


Any ideas? I wound up debugging the locating/resolving of the xsd's, but that was /somewhat/ complex and I wound up getting lost.

Fun fact: when I used the org.geotools.gml3.v3_2.GMLConfiguration configuration, it returned a SimpleFeatureCollection (because it could find the shipped XSD for gml 3.2). But it doesn't know how to interpret parts of the features (ie. things from my own schema).

Any help would be greatly appreciated!

Regards,

Meine

------------------------------------------------------------------------------
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to