Opened 18 years ago

Last modified 17 years ago

#1251 closed defect (fixed)

GML reader: strip namespaces

Reported by: bartvde@… Owned by: warmerdam
Priority: highest Milestone:
Component: OGR_SF Version: unspecified
Severity: blocker Keywords:
Cc:

Description

As mentioned in #1250, it would be desirable (at least in my opinion) to strip the namespaces from the XML elements in the GML reader. Previous post by Frank:

I think I have flip flopped at least once on the "stripping namespace" issue
in the GML driver without coming to any clear conclusion.  One problem is
that several name spaces can be used in GML and then preserving the name space
qualifier can be necessary to keep fields distinct. 

On the other hand, the namespace isn't really a proper part of the element
name. 

Garr. 

Well, I'd suggest resubmitting a bug report suggesting stripping of namespaces.

Change History (2)

comment:1 by warmerdam, 17 years ago

FYI the (long laborious) thread below.

There seems to be consensus that GDAL/OGR should be stripping the
namespaces (if the user wants to).

Maybe a flag for ogr2ogr like --strip-xml-namespaces ?


-----Original Message-----
From: Ron Lake [mailto:rlake@galdosinc.com] 
Sent: 25 October, 2006 8:48 PM
To: Simon Cox; Kralidis,Tom [Burlington]; Whiteside, Arliss E (US SSA)
Cc: Panagiotis (Peter) A. Vretanos; Bart van den Eijnden (OSGIS)
Subject: RE: WFS and default namespace

HI Simon:

Yes - I have to agree with Simon. The namespaces should NOT be made to
go away - so the prefixes are needed unless you can use an unqualified
keyword to supress them in some instances.  But definitely the WFS
should not be modified to "solve" this problem.  That would be to
introduce a "bug".

Cheers

Ron

-----Original Message-----
From: Simon Cox [mailto:Simon.Cox@csiro.au]
Sent: October 25, 2006 5:44 PM
To: Kralidis,Tom [Burlington]; Ron Lake; Whiteside, Arliss E (US SSA)
Cc: Panagiotis (Peter) A. Vretanos; Bart van den Eijnden (OSGIS)
Subject: Re: WFS and default namespace

It appears that the problem is a consequence of the strategy used by
GDAL/OGR in mapping QNames to database fields.
That is not really a WFS issue, since it is on the private side of the
interface.
WFS uses XML so everything on the public side must respect namespaces.

Simon

----- Original Message -----
From: "Kralidis,Tom [Burlington]" <Tom.Kralidis@ec.gc.ca>
To: "Ron Lake" <rlake@galdosinc.com>; "Whiteside, Arliss E (US SSA)" 
<arliss.whiteside@baesystems.com>
Cc: "Panagiotis (Peter) A. Vretanos" <pvretano@cubewerx.com>;
<Simon.Cox@csiro.au>; "Bart van den Eijnden (OSGIS)" <bartvde@osgis.nl>
Sent: Thursday, October 26, 2006 2:42 AM
Subject: RE: WFS and default namespace



Ron,

No, of course documents may have many namespaces, but defining xmlns
allows for expressing elements under that namespace without explicit
prefix.

Maybe this example will help.  This all started from a bug fix Bart
(cc'ed) provided for MapServer WFS, and now we're battling on which
approach to take:

- User wishes to convert a WFS GetFeature response to ESRI shapefile

- User invokes MapServer WFS GetFeature response

- MapServer reads a shapefile / dbf
 - dbf has fields like id, class
- MapServer outputs like:
 <gml:featureMember>
  <ms:id>4444</ms:id>
  <ms:class>5</ms:class>

- User saves GetFeature to disk
- User invokes GDAL/OGR ogr2ogr too for the conversion
- the output DBF column names are marked as ms_id, ms_class

The user does not want these prefixes here.  So what is the best
approach, in terms of this use case

1./ conversion tool offers flag for stripping namespace on columns 2./
WFS outputs data columns in a default namespace, hence no prefixes 3./
...

..Tom



> > -----Original Message-----
> > From: Ron Lake [mailto:rlake@galdosinc.com]
> > Sent: 25 October, 2006 1:42 PM
> > To: Kralidis,Tom [Burlington]; Whiteside, Arliss E (US SSA)
> > Cc: Panagiotis (Peter) A. Vretanos; Simon.Cox@csiro.au
> > Subject: RE: WFS and default namespace
> >
> > Hi,
> >
> > Are you implying that for a some WFS that its application schema 
> > (assuming there is only one) has a well known namespace?  Can you be a

> > bit more explicit?
> >
> > R
> >
> > -----Original Message-----
> > From: Kralidis,Tom [Burlington] [mailto:Tom.Kralidis@ec.gc.ca]
> > Sent: October 25, 2006 10:33 AM
> > To: Ron Lake; Whiteside, Arliss E (US SSA)
> > Cc: Panagiotis (Peter) A. Vretanos; Simon.Cox@csiro.au
> > Subject: RE: WFS and default namespace
> >
> >
> > Ron,
> >
> > It would mean that, on output, a WFS / GML response would not have to 
> > explcitly prefix elements, i.e. foo:element.  A parser would know that

> > element is part of xmlns.
> >
> > ..Tom
> >
> >
>> > > -----Original Message-----
>> > > From: Ron Lake [mailto:rlake@galdosinc.com]
>> > > Sent: 25 October, 2006 1:23 PM
>> > > To: Kralidis,Tom [Burlington]; Whiteside, Arliss E (US SSA)
>> > > Cc: Panagiotis (Peter) A. Vretanos; Simon.Cox@csiro.au
>> > > Subject: RE: WFS and default namespace
>> > >
>> > > HI Tom:
>> > >
>> > > What would a default namespace mean?
>> > >
>> > > R
>> > >
>> > > -----Original Message-----
>> > > From: Kralidis,Tom [Burlington] [mailto:Tom.Kralidis@ec.gc.ca]
>> > > Sent: October 24, 2006 7:09 PM
>> > > To: Whiteside, Arliss E (US SSA)
>> > > Cc: Panagiotis (Peter) A. Vretanos; Ron Lake; Simon.Cox@csiro.au
>> > > Subject: RE: WFS and default namespace
>> > >
>> > >
>> > > Hi Arliss,
>> > >
>> > > Thanks for the info.
>> > >
>> > > I didn't find anything in Annex C as far as an instance document.
>> > >
>> > > Should there be a 'best practice' on how to define what a default 
>> > > namespace is and whether the default namespace should too be 
>> > > explicitly put out on output?
>> > >
>> > > ..Tom
>> > >
>> > >
>>> > > > -----Original Message-----
>>> > > > From: Whiteside, Arliss E (US SSA) 
>>> > > > [mailto:arliss.whiteside@baesystems.com]
>>> > > > Sent: 24 October, 2006 6:08 PM
>>> > > > To: Kralidis,Tom [Burlington]
>>> > > > Subject: RE: WFS and default namespace
>>> > > >
>>> > > > Tom,
>>> > > >
>>> > > > Sorry, I can't think of any existing guidance on default XML 
>>> > > > namespaces.
>>> > > > Have you looked at the examples in Annex C of the GML simple 
>>> > > > features profile [OGC 06-049r1], available at 
>>> > > > http://portal.opengeospatial.org/files/?artifact_id=15201.
>>> > > >
>>> > > > Arliss
>>> > > >
>>> > > >
>>> > > > 

comment:2 by warmerdam, 17 years ago

The logic to strip namespaces from gml attributes and feature class names
has been committed in CVS.  I have also written a simple test script as
part of the gdalautotest suite for the gml reading support.  It previously
lacked one. 


Note: See TracTickets for help on using tickets.