1

I wrote some code based on http://docs.geotools.org/stable/userguide/library/xml/geometry.html#id6

GML gml = new GML(Version.GML3);

try {
    InputStream in = new FileInputStream("file.gml");   

    SimpleFeatureIterator iter = gml.decodeFeatureIterator(in);

    while (iter.hasNext())
    {
        SimpleFeature feature = iter.next();
        System.out.println("Properties: "+feature.getProperties());
    }
}

This works well for most of my files but some other dataset comes with a XML schema that points to an offline host and a non-existent .xsd file. I trust the files so I would just like to ignore the schema.

How can I make GeoTools ignore the XML schema?

Searching online I found suggestions to do eg parser.setStrict(false), for example in https://github.com/boundlessgeo/geotools-2.7.x/raw/master/demo/gmlparsing/src/main/java/org/geotools/demo/gmlparsing/GMLParsing.java , but that uses a different approach in reading the file. If I created a Parser object, how do I tell gml.decodeFeatureIterator() do abide it?

I am very new to GeoTools so this question might be very confused.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.