Ok, now I'm getting this exception:

java.lang.RuntimeException: Parsing failed for ff_portugal_2002_4326: 
org.geotools.feature.IllegalAttributeException: No attribute named fireID
        at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:96)
        at 
org.geotools.xml.impl.BindingWalker$BindingExecutionChain.execute(BindingWalker.java:204)
        at org.geotools.xml.impl.BindingWalker.walk(BindingWalker.java:163)
        at 
org.geotools.xml.impl.ElementHandlerImpl.endElement(ElementHandlerImpl.java:191)
        at 
org.geotools.xml.impl.ParserHandler.endElement(ParserHandler.java:399)
        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 org.geotools.xml.Parser.parse(Parser.java:184)
        at org.geotools.xml.Parser.parse(Parser.java:146)
        at org.n52.wps.xml.GMLReader.readFromInputStream(GMLReader.java:38)
        at org.n52.wps.xml.GMLReader.readFromUrl(GMLReader.java:71)
        at gmlparsing.GMLTest.main(GMLTest.java:102)
Caused by: org.geotools.feature.IllegalAttributeException: No attribute 
named fireID
        at 
org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:283)
        at 
org.geotools.gml2.bindings.GMLAbstractFeatureTypeBinding.parse(GMLAbstractFeatureTypeBinding.java:236)
        at org.geotools.xml.impl.ParseExecutor.visit(ParseExecutor.java:84)
        ... 17 more

I am using a snapshot from this morning. But as I didn't manage to 
compile it completely, I only included the new 
gt2-xml-xsd-2.4-SNAPSHOT.jar and gt2-main-2.4-SNAPSHOT.jar JARs.

Cheers,
Michael

Justin Deoliveira wrote:
> Michael Lutz wrote:
>> Thanks. The StreamingParser works considerably better (if a little 
>> slower). Note that the xPath expression must be "//featureMember" 
>> (without the prefix).
> Right.. :) JXPath seems to not like the prefixes..., probably how the
> context is being setup.
> 
> Yeah the streaming parser will be considerably slower. I haven't quite
> got around to optimizing it yet. Right now a jxpath context is created
> for each element that gets parsed, this could definitely be improved.
>> I also tried "Alternative 2: Ignoring the Application Schema", but this 
>> didn't work. I get
>>
>> org.xml.sax.SAXException: Handler for wfs:FeatureCollection could not be 
>> found.
>>      at 
>> org.geotools.xml.impl.ParserHandler.startElement(ParserHandler.java:357)
>>      at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown 
>> Source)
>>      at ...
>>
>> I don't understand why the parser requires a handler for 
>> "wfs:FeatureCollection" if I tell it to ignore the schema? When I use 
>> the WFSConfiguration (which I created for WFS feature collections) 
>> instead of GMLConfiguration, I get the same exception for the 
>> application schema type, i.e. test:TestFeature in the example.
>>
> Sorry, the docs are somewhat at fault here :). You also need to specify
> the following property:
> 
> configuration.getProperties().add(Parser.Properties.PARSE_UNKNOWN_ELEMENTS);
> 
> Also, how recent is the snapshot you are working from? I have recently
> made some changes that make the parser a bit more lax when it comes to
> this situation. We have nigthtly snapshots going now so it should be
> available.
> 
> -Justin
>> Any ideas?
>>
>> Cheers,
>> Michael
>>
>>
>> Justin Deoliveira wrote:
>>> Hi Michael,
>>>
>>> I suggest for any reasonable size dataset you use the StreamingParser:
>>>
>>> StreamingParser parser =
>>>    new StreamingParser(configuration,"//gml:featureMember");
>>>
>>>    try{
>>>      Feature f = null;
>>>      while ( ( f = parser.parse() ) != null ) {
>>>         ...
>>>      }
>>>
>>>    }...
>>> }
>>>
>>> Some more info about streaming here:
>>>
>>> http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support
>>>
>>> -Justin
>>>
>>> Michael Lutz wrote:
>>>> We are running into big memory problems when trying to parse large GML 
>>>> files containing WFS feature collections (e.g. 25000 points, about 25MB 
>>>> as GML) using the following code:
>>>>
>>>> public static FeatureCollection readFromInputStream(InputStream in) {
>>>>    Configuration configuration  = new WFSConfiguration();
>>>>    Parser parser = new Parser(configuration);
>>>>    try{
>>>>      FeatureCollection fc = (FeatureCollection) parser.parse( in );
>>>>      in.close();
>>>>      return fc;
>>>>    } ...
>>>> }
>>>>
>>>> For this example, the used memory goes up to 800MB. After the parsing, 
>>>> it goes down again to around 60MB.
>>>>
>>>> Any ideas why this is, and where we should be looking for memory leaks?
>>>>
>>>> Cheers,
>>>> Michael
>>>>
>>>> -------------------------------------------------------------------------
>>>> Take Surveys. Earn Cash. Influence the Future of IT
>>>> Join SourceForge.net's Techsay panel and you'll get the chance to share 
>>>> your
>>>> opinions on IT & business topics through brief surveys-and earn cash
>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>> _______________________________________________
>>>> Geotools-devel mailing list
>>>> Geotools-devel@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>>>
>>>>
>>>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys-and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Geotools-devel mailing list
>> Geotools-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>> !DSPAM:1004,45dd6e58260167731818748!
>>
> 
> 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to