The parser pays attention to the schema referenced by your GML file; for anything that it cannot find it will treat it as a hashmap. For things it can find (that extend AbstractFeature) it will parse into a Feature.
Ben have you tried parsing with the application application schema? Or just encoding thus far. Simon there have been few examples of "complex" schemas to parse up till now; you can review the test cases to see if that case has been tested (and how to configure and run). I expect you need to set up your own configuration; and tell the parser where your schema is located; prior to parsing or encoding. On trunk (ie 2.7) I started creating a GML utility class to help make configuration easier; you can look at this code for examples of how to configure. When you get something working please pass it back to the list; as I would like to extend the GML class (and examples) showing how to work with complex content. (Also in the GML class I have some code that will *try* and parse things into a simple feature; even if the schema cannot be found). Jody On 14/09/2010, at 10:28 AM, Simon Templer wrote: > Hi all, > > I have a data set in GML that I am trying to parse into a > FeatureCollection. I'm using GeoTools 2.6.4. > > Schemas (NAS-Operationen.xsd): > http://community.esdi-humboldt.eu/attachments/117/NAS_6.0.1.zip > Example Data: https://www.igd.fraunhofer.de/download/file.php?h=R50601 > > When using the GMLConfiguration (gml3 package) as parser configuration I > get a FeatureCollection with one AX_Flurstueck Feature back, but all > complex properties (e.g. gemeindezugehoerigkeit) are represented by > HashMaps. > > To get a better result I tried using the ApplicationSchemaConfiguration. > When parsing the schema it produced a StackOverflowError. I solved this > with a small change to the SchemaLocationResolver in > ApplicationSchemaXSD: the location URI is normalized before it is > returned. To implement this I basically create a copy of > ApplicationSchemaConfiguration and ApplicationSchemaXSD (see > http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.gmlparser/src/eu/esdihumboldt/hale/gmlparser/HaleSchemaConfiguration.java > > and > http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.gmlparser/src/eu/esdihumboldt/hale/gmlparser/HaleSchemaXSD.java). > > With the adapted application schema configuration I can parse the GML > without error, but the result I get is only a hierarchy of HashMaps - > there is no FeatureCollection or Feature created. > > Has somebody an idea what goes wrong here? Why is the result even worse > when just using the GMLConfiguration? > Should it be possible to parse features with complex properties using > the ApplicationSchemaConfiguration? Are there any alternatives? > > Thanks in advance for your help. > > Cheers > Simon > > P.S.: If you need more details about how I do the parsing have look at > http://community.esdi-humboldt.eu/repositories/entry/hale/eu.esdihumboldt.hale.gmlparser/src/eu/esdihumboldt/hale/gmlparser/HaleGMLParser.java > > -- > Dipl.-Inform. Simon Templer > > Fraunhofer-Institut für Graphische Datenverarbeitung IGD > Fraunhoferstr. 5 | 64283 Darmstadt | Germany > Tel +49 6151 155-408 | Fax +49 6151 155-444 > [email protected] | www.igd.fraunhofer.de > > ------------------------------------------------------------------------------ > Start uncovering the many advantages of virtual appliances > and start using them to simplify application deployment and > accelerate your shift to cloud computing. > http://p.sf.net/sfu/novell-sfdev2dev > _______________________________________________ > Geotools-gt2-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
