I use GeoTools-2.5.4 version, not from svn.
I would appreciate if you can send me updated gml jar.

By the way, these days i try to read data from gml file and render them on map 
as layers.

I am not quite sure what i need to do to accomplish this. I suppose that i need 
to read data 
from gml into GMLDataStore and get FeatureSource from it. Does URI which should 
be passed 
to GMLDataStore must point to target gml document?
If there is any example on how to do this i would appreciate if you can send me 
a link.

Thanks in advance!




Thanks for the link. I downloaded it and I was able to reproduce the 
problem. I believe the problem lies in the encoding specified in 
places.gml. When i change it to "iso-8859-1" I can parse it correctly.

However, one issue, after I changed the encoding i ran into another bug 
which prevented parsing. I fixed it and committed the fix to svn. Which 
version of GeoTools are running from? And are you running from svn? If 
you are running from svn just do an update. If not I can send you an 
updated gml jar.

-Justin


iceDice wrote:
> 
> Here is link that works: http://examples.oreilly.com/webmapping/
> There is places_gml.zip that contain places.gml and places.xsd
> 
> 
> 
> Hmm, that link does not work for me. If the file is a reasonable size 
> feel free to send it to me directly.
> 
> Here are the links to the xsd and xml files:
> 
> http://svn.osgeo.org/geotools/branches/2.5.x/modules/extension/xsd/xsd-gml3/src/test/resources/org/geotools/gml3/states.xml
> http://svn.osgeo.org/geotools/branches/2.5.x/modules/extension/xsd/xsd-gml3/src/test/resources/org/geotools/gml3/states.xsd
> 
> -Justin
> 
> iceDice wrote:
>> Thanks Justin,
>>
>> <Does your GML document have any multi byte characters in it?>
>> Here is link to gml gile that i try to parse: 
>> http://examples.oreilly.com/webmapping/places.gml
>>
>> Can you give me links to states.xml and states.xsd which are used in 
>> GML3ParsingTest?
>>
>>
>>
>> The warnings are expected unless your instance document exactly 
>> references the schema that describes.. .it most don't. SO what the 
>> parser does is try to parse anyways, and omits warnings for element it 
>> does not know the exact type of.
>>
>> As for the actual exception (invalid byte...) i am not quite sure. Does 
>> your GML document have any multi byte characters in it?
>>
>> I just committed a test case that shows a good example of how to use the 
>> parser. It is for GML3, but the process is more or less identical for gml2.
>>
>> http://svn.osgeo.org/geotools/branches/2.5.x/modules/extension/xsd/xsd-gml3/src/test/java/org/geotools/gml3/GML3ParsingTest.java
>>
>> Hope that helps.
>>
>> -Justin
>>
>> iceDice wrote:
>>> Hello,
>>>
>>> I would like to parse GML document, create FeatureCollection and render 
>>> them in JMapPane.
>>> I found one example on how to do this on: 
>>> http://docs.codehaus.org/display/GEOTDOC/GML+XML+Support and follow them.
>>>
>>> However when i try to parse some gml document i got following exceptions:
>>>
>>> Apr 11, 2009 7:29:06 PM org.geotools.xml.impl.ParserHandler startElement
>>> INFO: Could not find declaration for: 
>>> {http://ogr.maptools.org/}FeatureCollection. Creating a mock element 
>>> declaration and parsing anyways...
>>> Apr 11, 2009 7:29:06 PM org.geotools.xml.impl.ParserHandler startElement
>>> INFO: Could not find declaration for: 
>>> {http://ogr.maptools.org/}geometryProperty. Creating a mock element 
>>> declaration and parsing anyways...
>>> Apr 11, 2009 7:29:06 PM org.geotools.xml.impl.ParserHandler startElement
>>> INFO: Could not find declaration for: {http://ogr.maptools.org/}AREA. 
>>> Creating a mock element declaration and parsing anyways...
>>> Apr 11, 2009 7:29:06 PM org.geotools.xml.impl.ParserHandler startElement
>>> INFO: Could not find declaration for: {http://ogr.maptools.org/}PERIMETER. 
>>> Creating a mock element declaration and parsing anyways...
>>> Apr 11, 2009 7:29:06 PM org.geotools.xml.impl.ParserHandler startElement
>>> INFO: Could not find declaration for: {http://ogr.maptools.org/}PACEL_. 
>>> Creating a mock element declaration and parsing anyways...
>>> ...
>>> (this is only one part)
>>>
>>> org.xml.sax.SAXParseException: Invalid byte 2 of 3-byte UTF-8 sequence.
>>>     at 
>>> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown 
>>> Source)
>>>     at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
>>>     at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
>>>     at org.apache.xerces.impl.XMLErrorReporter.reportError(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:180)
>>>     at org.geotools.xml.Parser.parse(Parser.java:140)
>>>
>>>
>>> There is adequate schema file in same folder where is my .gml file.
>>>
>>> Can someone tell me what problem is and how to fix it?
>>>
>>> Also i would appreciate if someone can give me example for parsing GML file 
>>> with Geotools that works, with example .gml and .xsd files.
>>>
>>>
>>> Thanks.
>>>
>>
> 
> 


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users



-- 
View this message in context: 
http://n2.nabble.com/GeoTools-Parsing-GML-document-tp2621340p2624678.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to