Gérald Quintana ha scritto:
> Hello,
> 
> I am a newbie in the GIS area.
> 
> I would like to convert GML data coming from an XML file and
> representing a map layer into a Shapefile. What I call "GML file" is
> something like the "\org\geotools\test-data\xml\gml\Streams.gml" in
> gt2-sample-data .
> 
> But I get the Timeout exception:
> java.io.IOException: org.xml.sax.SAXException: Timeout
>       at org.geotools.xml.gml.FCBuffer.hasNext(FCBuffer.java:294)
>       at 
> org.geotools.data.gml.FileGMLDataStore.getSchema(FileGMLDataStore.java:155)
>       at 
> org.geotools.data.gml.FileGMLDataStore.getSchema(FileGMLDataStore.java:118)
>       at 
> org.geotools.data.AbstractDataStore.getFeatureReader(AbstractDataStore.java:329)
>       at ...
> Caused by: org.xml.sax.SAXException: Timeout
>       at org.geotools.xml.gml.FCBuffer.getFeatureType(FCBuffer.java:228)
>       at org.geotools.xml.gml.FCBuffer.getFeatureReader(FCBuffer.java:201)
>       at org.geotools.xml.gml.FCBuffer.getFeatureReader(FCBuffer.java:189)
>       at 
> org.geotools.data.gml.FileGMLDataStore.getSchema(FileGMLDataStore.java:153)
>       ... 22 more
> 
> Why do I get a "Timeout" exception since the GML file is local?

Hum.... your xml file should be referencing other schemas that must be 
downloaded in order to validated the contents of the file.
May it be that you cannot reach those?

Anyways, I looked at the code, and that error is thrown when the parser 
takes too much time to perform parsing. Here is the code:

public FeatureType getFeatureType() {
         if(ft != null)
             return ft;
         Date d = new Date(Calendar.getInstance().getTimeInMillis() + 
timeout);

         while ((ft == null) && ((state != FINISH) && (state != STOP))) {
             yield(); // let the parser run ... this is being called from

             if (d.before(Calendar.getInstance().getTime())) {
                 exception = new SAXException("Timeout");
                 state = STOP;
             }
         }

         // the original thread
         if ((state == FINISH) || (state == STOP)) {
             return ft;
         }

         return ft;
     }

I don't exactly know where, but it seems you can set a maximum parsing 
time...

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to