|
From: Jody G. <jod...@gm...> - 2014-12-17 06:02:17
|
Hi Felix: Based on the error message it is trying to find a binding for something called n52:TestGML. Reading that it looks like n52 :TestGML extends n52:FeatureType - have you defined n52:FeatureType? For the GeoTools parser to work you need to define everything, it will build up a model of your schema in memory, associated a "binding" with each entry in the model (such as n52:FeatureType) and use these bindings to turn XML into Java objects. Out of the box it turns standard XML sequences into lists, and complexTypes into a java.util.Map - so you should get *something*. But only if your schema completes. For more information I strongly recommend you go through the docs, and tutorial. - http://docs.geotools.org/latest/userguide/library/xml/internal/index.html - http://docs.geotools.org/latest/userguide/library/xml/internal/overview.html - http://docs.geotools.org/latest/userguide/library/xml/internal/tutorial.html The code generator section used above is a out out of date (it was just used to make java beans to practice binding to). -- Jody Garnett On 12 December 2014 at 05:01, Felix Scholtyssek <fel...@di...> wrote: > > Hi everybody, > > I have a pproblem with the GML 3 parser from geotools. > I have an GML and a schema, but in the method getImports I get an error > message, and no result object. > > Can somebody find a solution for this problem? > > The Error message is: > Dez 12, 2014 1:54:45 PM org.geotools.xml.Schemas getImports > INFORMATION: Schema import wasn't resolved: http://www.opengis.net/gml > declared location: http://schemas.opengis.net/gml/3.1.1/base/gml.xsd > Dez 12, 2014 1:54:45 PM org.geotools.xml.impl.ParserHandler startElement > INFORMATION: parser configuration specified schema: > 'http://www.openplans.org/n52', but instance document does not reference > this schema. > > 2014-12-12 13:54:45,660 [pool-1-thread-4] ERROR > org.n52.wps.io.datahandler.parser.GML3BasicParser: Exception while > handling parsed GML. > org.xml.sax.SAXException: Handler for n52:TestGML could not be found. > at > org.geotools.xml.impl.ParserHandler.startElement(ParserHandler.java:676) > ~[gt-xsd-core-8.7.jar:na] > > > Here is my GML: > <gml:FeatureCollection > xmlns:gml="http://www.opengis.net/gml" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation=" > http://www.opengis.net/gml > http://schemas.opengis.net/gml/3.1.1/base/feature.xsd > http://www.openplans.org/n52 > http://localhost:8282/wps-demo-dev/demos/testGML.xsd"> > <gml:featureMember> > <n52:TestGML xmlns:n52="http://www.openplans.org/n52" > gml:id="ID0"> > <gml:boundedBy> > <gml:Envelope srsDimension="2" > srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"> > <gml:lowerCorner>10.0 > 10.0</gml:lowerCorner> > <gml:upperCorner>10.0 > 10.0</gml:upperCorner> > </gml:Envelope> > </gml:boundedBy> > <n52:GEOMETRY> > <gml:MultiPoint srsDimension="2" > srsName="http://www.opengis.net/gml/srs/epsg.xml#4326"> > <gml:pointMember> > <gml:Point > srsDimension="2"> > <gml:pos>10.0 > 10.0</gml:pos> > </gml:Point> > </gml:pointMember> > </gml:MultiPoint> > </n52:GEOMETRY> > </n52:TestGML> > </gml:featureMember> > </gml:FeatureCollection> > > > Here is my schema: > <?xml version="1.0" encoding="ISO-8859-1"?> > <xs:schema > targetNamespace="http://localhost:8282/wps-demo-dev/demos/TestGML" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > xmlns:n52="http://www.openplans.org/n52" > elementFormDefault="qualified" version="1.0"> > <xs:import namespace="http://www.opengis.net/gml" > schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd" /> > <xs:element name="TestGML" type="n52:FeatureType" > substitutionGroup="gml:_Feature" /> > <xs:complexType name="FeatureType"> > <xs:complexContent> > <xs:extension base="gml:AbstractFeatureType"> > <xs:sequence> > <xs:element name="GEOMETRY" > type="gml:MultiPointPropertyType"> > </xs:element> > </xs:sequence> > </xs:extension> > </xs:complexContent> > </xs:complexType> > </xs:schema> > > > Thanks for this. > > Felix Scholtyssek > > > ------------------------------------------------------------------------------ > Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server > from Actuate! Instantly Supercharge Your Business Reports and Dashboards > with Interactivity, Sharing, Native Excel Exports, App Integration & more > Get technology previously reserved for billion-dollar corporations, FREE > > http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk > _______________________________________________ > GeoTools-GT2-Users mailing list > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > |