GML Parser problem (cannot parse some gml files)

2 messages Options
Embed this post
Permalink
Michael Wong

GML Parser problem (cannot parse some gml files)

Reply Threaded More More options
Print post
Permalink
Hi, all,

I am a new Geotools user, who want to parse GML file using Geotools library. After reading the tutorial page on http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support, and searching some articles on the mailing list, I am able to parse some of gml files. However, some other gml files can not be parsed by Geotools. All the gml files are all passed by the XmlSpy validation, so they should be both well-formed and validated. I appreciate if anyone can help me out about this parsing problem.

The following sensorML.xml file cannot be parsed by my my Java program TestGeoTools2.java, which uses GeoTools. The sensorML.xml reference an external schema file.  My GeoTools version is 2.5.4.

TestGeoTools2.java
sensorML.xml


The Exception that I got is as following:

Jun 24, 2009 4:04:40 PM org.geotools.xml.impl.ParserHandler startElement
WARNING: Error parsing: http://schemas.opengis.net/sensorML/1.0.1/sensorML.xsd
Jun 24, 2009 4:04:40 PM org.geotools.xml.impl.ParserHandler startElement
WARNING: Could not find a schema
Jun 24, 2009 4:04:54 PM org.geotools.xml.impl.ParserHandler startElement
INFO: Could not find declaration for: {http://www.opengis.net/sensorML/1.0.1}SensorML. Creating a mock element declaration and parsing anyways...
Jun 24, 2009 4:04:54 PM org.geotools.xml.impl.ParserHandler startElement
...
...
Exception in thread "main" java.lang.ClassCastException: java.util.HashMap cannot be cast to org.geotools.feature.FeatureCollection
        at TestGeoTools2.main(TestGeoTools2.java:20)

Justin Deoliveira

Re: GML Parser problem (cannot parse some gml files)

Reply Threaded More More options
Print post
Permalink
Hi Michael,

I am not sure it will be possible to parse sensor ml with geotools. The
GML support is limited to the simple features level 0 profile. I am not
familiar with sensorml but I would think it would take a bit of work to
get the parser to handle it.

-Justin

Michael Wong wrote:

> Hi, all,
>
> I am a new Geotools user, who want to parse GML file using Geotools library.
> After reading the tutorial page on
> http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support, and searching some
> articles on the mailing list, I am able to parse some of gml files. However,
> some other gml files can not be parsed by Geotools. All the gml files are
> all passed by the XmlSpy validation, so they should be both well-formed and
> validated. I appreciate if anyone can help me out about this parsing
> problem.
>
> The following sensorML.xml file cannot be parsed by my my Java program
> TestGeoTools2.java, which uses GeoTools. The sensorML.xml reference an
> external schema file.  My GeoTools version is 2.5.4.
>
> http://n2.nabble.com/file/n3152178/TestGeoTools2.java TestGeoTools2.java
> http://n2.nabble.com/file/n3152178/sensorML.xml sensorML.xml
>
>
> The Exception that I got is as following:
>
> Jun 24, 2009 4:04:40 PM org.geotools.xml.impl.ParserHandler startElement
> WARNING: Error parsing:
> http://schemas.opengis.net/sensorML/1.0.1/sensorML.xsd
> Jun 24, 2009 4:04:40 PM org.geotools.xml.impl.ParserHandler startElement
> WARNING: Could not find a schema
> Jun 24, 2009 4:04:54 PM org.geotools.xml.impl.ParserHandler startElement
> INFO: Could not find declaration for:
> {http://www.opengis.net/sensorML/1.0.1}SensorML. Creating a mock element
> declaration and parsing anyways...
> Jun 24, 2009 4:04:54 PM org.geotools.xml.impl.ParserHandler startElement
> ...
> ...
> Exception in thread "main" java.lang.ClassCastException: java.util.HashMap
> cannot be cast to org.geotools.feature.FeatureCollection
> at TestGeoTools2.main(TestGeoTools2.java:20)
>
>


--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users