By telling the parser to ignore the schema location you are essentially
telling it to ignore your application schema types, so that when it
comes to actually parsing a feature, it really knows nothing about your
type of feature. The upside is that the parser can be used for any
application schema.

On the other hand, if the parser does not ignore the schema location,
then the schema location has to be exactly right. The ApplicationSchema
class is a convenience to be able to specify the locaftion of the
application schema explicitly.

You are right, if ignoring the schema it wont really a difference.
However I am puzzled why the binding for AbstractFeatureType is
executing then... So just trying to get an idea of how the parser is
configured.

I appreciate your patience, you are really the first user actually using
the parser for client side wfs / gml, so I am not suriprised that their
are issues.

Michael Lutz wrote:
> I'm a bit at a loss here. Why does the Configuration matter if the 
> schema is to be ignored anyway? I have been using the WFSConfiguration, 
> but it also does not work with GMLConfiguration. I have not set up an 
> ApplicationSchema configuration as I thought the whole point of the 
> exercise was that one didn't need one.
> 
> I've tried both the StreamParser and the normal Parser, both to no 
> avail. Even just accessing the Point geometries (as in the example in 
> the User Guide) keeps giving me the same exception message.
> 
> Michael
> 
> 
> Justin Deoliveira wrote:
>> Hmmm... looks like the parser isn't managing to parse your application
>> feature type correctly into a geotools feature type. Which method of
>> stream pasring are you using? Are you passing in your wfs configuration,
>> or an ApplicationSchema configuration?
>>
>> Michael Lutz wrote:
>>> 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
>>>>>
>>>>>
>>>>>
>>> -------------------------------------------------------------------------
>>> 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,45deb012158832081064789!
> 


-- 
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
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