hi Yann,
seems to be simply that the schema referenced by the gml file is not
accessible. Whether it points to a relative location or an absolute URL, the
schema shall be there and shall be fully referenceable (i.e. the chain of
includes and imports should be accessible), except if you have a custom
SchemaLocationResolver for them (that happens for example to the gml schemas,
whose location is "overrriden" by the one in the gt gml jar, so they don't
need to be downloaded from schemas.opengis.net each time)
I would say make sure the gml points correctly to its root schema file try
again. This is needed as the parser is schema driven, so it can inferr the
correct types, etc, for your feature type.
regards,
Gabriel
On Monday 10 September 2007 19:48:55 Yann Semet wrote:
> Hi Jody, [All],
>
> In order to parse OS data gml files, Vince and I tried what you suggest
> below, more precisely the following code snippet:
>
> [...]
> Configuration configuration = new GMLConfiguration();
> Parser parser = new Parser( configuration );
> InputStream xml = new FileInputStream("C:\\gml\\myFile");
> FeatureCollection fc = (FeatureCollection) parser.parse(xml );
> [...]
>
> Where myFile is standard Ordonance Survey Master Map (OSSM) gml. We get the
> following trace :
>
> 10 sept. 2007 19:18:48
> org.geotools.xml.Schemas$SchemaLocationResolverAdapter
> resolveSchemaLocation ATTENTION: Could not resolve schema location:
> OSComplexTypes.xsd to physical location.
>
> 10 sept. 2007 19:18:48 org.geotools.xml.impl.ParserHandler startElement
> ATTENTION: Error parsing: file:///C:/gml/OSDNFFeatures.xsd
> org.xml.sax.SAXException: Error parsing: file:///C:/gml/OSDNFFeatures.xsd
> at
> org.geotools.xml.impl.ParserHandler.startElement(ParserHandler.java:294)
> at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)
> at
> org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRoo
>t ElementHook(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispat
>c her.dispatch(Unknown Source)
> at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)
> [...]
> Caused by: java.lang.NullPointerException
> at org.eclipse.emf.common.util.URI.createURIWithCache(URI.java:655)
> at org.eclipse.emf.common.util.URI.createURI(URI.java:535)
> at
> org.eclipse.xsd.impl.XSDSchemaDirectiveImpl.resolve(XSDSchemaDirectiveImpl.
>j ava:343)
> at
> org.eclipse.xsd.impl.XSDIncludeImpl.patch(XSDIncludeImpl.java:233)
> [...]
>
>
> The beginning of the gml file is as follows :
>
> <?xml version='1.0' encoding='UTF-8'?>
> <osgb:FeatureCollection
> xmlns:osgb='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb'
> xmlns:gml='http://www.opengis.net/gml'
> xmlns:xlink='http://www.w3.org/1999/xlink'
> xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
> xsi:schemaLocation='http://www.ordnancesurvey.co.uk/xml/namespaces/osgb
> http://www.ordnancesurvey.co.uk/xml/schema/v7/OSDNFFeatures.xsd'
> fid='GDS-39047-78'>
> <gml:description>Ordnance Survey, (c) Crown Copyright. All rights reserved,
> 2007-09-04</gml:description>
> [...]
>
>
> It points to OSDNFFeatures.xsd which begins like this :
> <?xml version="1.0" encoding="UTF-8"?>
> <schema
> targetNamespace="http://www.ordnancesurvey.co.uk/xml/namespaces/osgb"
> xmlns="http://www.w3.org/2001/XMLSchema"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:osgb="http://www.ordnancesurvey.co.uk/xml/namespaces/osgb"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> version="3.9">
> <annotation>
> <appinfo>OSDNFFeatures.xsd 3.9 2006/06/26</appinfo>
> <documentation xml:lang="en">Ordnance Survey, (c) Crown
> Copyright. All Rights Reserved June 2006.</documentation>
> <documentation xml:lang="en">See
> http://www.ordnancesurvey.co.uk for guidelines and related
> information</documentation>
> <documentation xml:lang="en">This schema defines the
> topographic, Address and ITN features and change only update departed
> features.</documentation>
> </annotation>
> <!-- include constructs from other OS schemas -->
> <include schemaLocation="OSComplexTypes.xsd"/>
> <!--import OGC constructs and namespaces -->
> <import namespace="http://www.opengis.net/gml"/>
> <import namespace="http://www.w3.org/1999/xlink"/>
>
> [...]
>
> With a direct reference to OSComplexTypes.xsd, etc.
>
> We did check that the urls for the .xsd files are indeed correct. We also
> tried to modify these urls to point directly on the hard drive, in the .gml
> file containing folder where copies of all the necessary .xsd files were
> present as well. Nothing we tried proved successful yet and we found no way
> yet to get our hands on the actual features. There seems to be a problem in
> the hierarchical resolution of xsd file names to their actual physical
> locations.
>
> Being newcomers, we're a little confused as to what the step we missed
> actually is. Are we facing a simple path problem (just letting the parser
> know where to look for .xsd files) or do we need to write a bunch of code
> to allow the parser to correctly work with our data? In particular, do we
> simply need to override stuff as suggested in
> http://docs.codehaus.org/display/GEOTDOC/2+SchemaLocationResolver+and+Schem
>a Locator ?
>
>
> Many thanks in advance,
>
> Yann SEMET
>
> -----Message d'origine-----
> De : [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] De la part de Jody
> Garnett Envoyé : mercredi 5 septembre 2007 21:24
> À : User-friendly Desktop Internet GIS
> Objet : Re: [udig-devel] GML loading - null pointer
>
> Vince if you want to try the new parser the instructions are here:
> - http://docs.codehaus.org/display/GEOTDOC/05+XML+Parsing+and+Encoding
>
> There is also a full developers guide:
> - http://docs.codehaus.org/display/GEOTDOC/XML+Developers+Guide
>
> If all you need are your features out of the darn file you should be
> able to use the above; from there you can try some hacks like adding a
> MemoryDataStore with the features to the uDig catalog, or just writing a
> FeatureSource.
>
> Cheers,
> Jody
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.485 / Virus Database: 269.13.6/991 - Release Date: 05/09/2007
> 14:55
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.485 / Virus Database: 269.13.10/995 - Release Date: 08/09/2007
> 13:24
>
>
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel