Opened 16 years ago

Closed 15 years ago

#2617 closed defect (fixed)

GML driver can't parse autotest gml files when built with xerces-3.0.0

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 1.6.0
Component: OGR_SF Version: unspecified
Severity: normal Keywords: gml xerces 3
Cc:

Description

When building GDAL against xerces-3.0.0, I discovered that the GML driver couldn't read anymore the test files of the autotest suite. The content of 'localname' in GMLHandler::startElement is always empty.

I finally managed to make it work again by removing "m_poSAXReader->setFeature( XMLString::transcode("http://xml.org/sax/features/namespaces"), false);"

See following patch :

Index: ogr/ogrsf_frmts/gml/gmlreader.cpp
===================================================================
--- ogr/ogrsf_frmts/gml/gmlreader.cpp	(révision 15548)
+++ ogr/ogrsf_frmts/gml/gmlreader.cpp	(copie de travail)
@@ -188,8 +188,6 @@
 #else
         m_poSAXReader->setFeature(
             XMLString::transcode("http://xml.org/sax/features/validation"), false);
-        m_poSAXReader->setFeature(
-            XMLString::transcode("http://xml.org/sax/features/namespaces"), false);
 #endif
     }
     catch (...)

The patch also works with xerces 2.8 (at least on the ionic_wfs.gml example). But as I don't understand all the subtelties of namespace processing I'm not sure if it's the right fix.

Change History (4)

comment:1 by Even Rouault, 16 years ago

Summary: GML driver can't parse autotest gml files when built with xerces-3.0.0[PATCH] GML driver can't parse autotest gml files when built with xerces-3.0.0

comment:2 by Even Rouault, 15 years ago

In fact, after testing again, my patch is not appropriate for xerces 2.8

It causes autotest to fail then with:

  TEST: ogr_gml_4 ... ERROR 1: XML Parsing Error: An exception occurred! Type:NetAccessorException, Message:Could not open file: http://www.ordnancesurvey.co.uk/xml/schema/v2/OSDNFFeatures.xsd

ERROR 1: XML Parsing Error: Fatal error encountered during schema scan

With xerces-3.0.0, the patch helps the tests to pass... but it downloads http://www.ordnancesurvey.co.uk/xml/schema/v2/geometry.xsd, which is not desirable

comment:3 by Even Rouault, 15 years ago

Summary: [PATCH] GML driver can't parse autotest gml files when built with xerces-3.0.0GML driver can't parse autotest gml files when built with xerces-3.0.0

comment:4 by Even Rouault, 15 years ago

Milestone: 1.6.0
Resolution: fixed
Status: newclosed

Fixed in r15773.

Don't ask me *why* this works. It's just derived from empirical testing. I can't explain because it appears that xerces 3 and xerces 2 have the same default values for those options. See http://xerces.apache.org/xerces-c/apiDocs-3/classSAX2XMLReader.html#a597ea87071e1a0aa1288567e4bfd6d7 and http://xerces.apache.org/xerces-c/apiDocs-2/classSAX2XMLReader.html#a597ea87071e1a0aa1288567e4bfd6d7

Note: See TracTickets for help on using tickets.