|
From: Akos M. <ak...@ma...> - 2013-04-07 08:04:23
|
Hi, I'm trying to continue on my quest to have GeoTools process AIXM documents, and as suggested earlier, I'm looking at the OWS package for inspiration. I saw that the OWS package has an EMF-generated class hierarchy, and basically it's turning XML ements into these EMF-generated classes. I figured an approach would be to do something similar with my JAXB generated class hierarchy, as I already have JAXB bindings set up. But I ran into practical & conceptual issues, see below. I'm starting with a simple sample document that describes a single airspace, which is in effect a GML PolygonPatch with some metadata attached: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/var/test.aixm for all the XML Schemas I already have JAXB code generation set up, this is the binding file: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/resources/binding.xjb although the generated classes are not checked in to the repository I tried to create initial / minimal versions of GTXML parser configurations & bindings here: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/java/org/openaviationmap/aixm/AixmMessageParserConfiguration.java https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/java/org/openaviationmap/aixm/AIXMMessage.java https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/java/org/openaviationmap/aixm/bindings/AIXMBasicMessageBinding.java and I have a very simple unit test for this here: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/test/java/org/openaviationmap/aixm/AIXMMessageParserTest.java now, I encountered a number of conceptual problems that I'm not sure how to solve, and I'd really appreciate pointers & help: - addding org.geotools.gm3.v3_2.GMLConfiguration as a depedency to my parser configuration doesn't make the GTXML parser parse GML data for example, the first child of the root node in the test document contains a gml:boundedBy (gml:BoundingShapeType) construct, as documented here: http://www.sisostds.org/FEATProgrammersReference/feature_xsd.html - but even if I added the above GMLConfiguration as an addDependency() call to my configurations constructor (here, line 25: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/java/org/openaviationmap/aixm/AixmMessageParserConfiguration.java#25 ) it seems that this is not parsed my the GTXML parser, and I get a simple NodeImpl instance for it in AIXMBasicMessageBinding.parse(). - package mismatch between JAXB-generated and geotools GML constructs geotools has a org.geotools.xml.gml.GMLComplexTypes.BoundingShapeType class, while of course JAXB also generates a class by this name for the GML schema. moreover, if my aim is to return the JAXB-generated classes from my bindings parse() function, of course it would only accept the object related to it, that is, the JAXB-generated object. (see line 81 here: https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/java/org/openaviationmap/aixm/bindings/AIXMBasicMessageBinding.java#81 ) does this mean that basically it's not possible to work with the JAXB-generated class structure? - if JAXB can already parse the whole file, what is the point of re-creating the parsing process? from a conceptual perspective, I'm kind of lost here with creating / generating binding classes that extend AbstractComplexBinding, and basically duplicating the JAXB parsing functionality in each of these classes parse() function, just to come up with the same object hierarchy JAXB's unmarshaller can already create with two lines of code. this seems to be a useless exercise. as you can see, I'm lost again, and maybe I'm asking totally irrelevant or obvious questions. I feel a little bit like Leisure Suite Larry in the Land of Lounge Lizards :) Akos <https://code.google.com/p/openaviationmap/source/browse/branches/oam-java-tools/aixm-datastore/src/main/resources/binding.xjb> |