Hi, I figured out the first problem I had. It was caused by a too long <coordinates> element, which the parser somehow couldn't handle.
I've changed to using <coord><X><Y></coord> pairs and run into the following
exception:
Oct 14, 2005 10:25:07 AM org.geotools.xml.XMLSAXHandler endElement
WARNING: An X coord is required
Oct 14, 2005 10:25:07 AM org.geotools.xml.XMLSAXHandler endElement
WARNING: Line 31 Col 97
java.util.NoSuchElementException: Could not aquire
feature:java.io.IOException: org.xml.sax.SAXException: An X coord is required
at org.geotools.data.store.NoContentIterator.next(NoContentIterator.java:37)
at gt2test.WFSClient.main(WFSClient.java:49)
Caused by: java.io.IOException: org.xml.sax.SAXException: An X coord is
required
at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:304)
at
org.geotools.data.wfs.WFSFeatureReader.loadElement(WFSFeatureReader.java:164)
at org.geotools.data.wfs.WFSFeatureReader.hasNext(WFSFeatureReader.java:153)
at org.geotools.data.wfs.WFSDataStore.getFeatureReader(WFSDataStore.java:763)
at
org.geotools.data.wfs.WFSFeatureSource$WFSFeatureResults.reader(WFSFeatureSource.java:168)
at
org.geotools.data.store.DataFeatureCollection.iterator(DataFeatureCollection.java:193)
at gt2test.WFSClient.main(WFSClient.java:46)
Caused by: org.xml.sax.SAXException: An X coord is required
at org.geotools.xml.XMLSAXHandler.endElement(XMLSAXHandler.java:229)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:176)
at org.geotools.xml.DocumentFactory.getInstance(DocumentFactory.java:139)
at org.geotools.data.wfs.WFSFeatureReader.run(WFSFeatureReader.java:123)
I've traced the exception to the GMLComplexTypes class method getValue(Element
element, ElementValue[] value, Attributes attrs, Map hints) [line 3695]. In
this method the coordinates should be assigned but there is a problem with
the if statements:
if(elements[0].getName().equals(value[i].getElement().getType().getName())) {
elements[0].getName() returns "X" but
value[i].getElement().getType().getName() returns "decimal".
Since I am not really familiar with how the whole code works, I can't say
whether this is a bug earlier on or whether the inner evaluation should be
changed to:
value[i].getElement().getName() which would return "X".
I'm using Geotools2 version 2.1.
Greetings,
Mark
--
You fill a much-needed gap.
My GPG public key is available at:
http://www.edu.uni-klu.ac.at/~mhall/data/security/MarkHall.asc
pgpcoz1FQbrQx.pgp
Description: PGP signature
