QuakeML catalog import: XML namespaces that qualify for .extra mechanism

Hi all,

currently, only XML extension elements with namsepaces that do *not* start
with http://quakeml.org/xmlns/ are included into the .extra mechanism. I find
that a bit too restrictive because

i) Nothing prevents users to assign such namespaces to their extension
elements (which is fine for development and testing, or documents that are not
public). Then there is a big surprise that these elements are missing in
.extra. One has to dig deep into the source code to find out why.

ii) In particular, extension elements that are taken from the semi-official
QuakeML 2.0 draft (and thus live "legally" in http://quakeml.org/xmlns/) are
neglected.

I suggest that all namespaces are allowed (with the exception, of course, of
the document's namespaces, http://quakeml.org/xmlns/quakeml/1.2 and http://
quakeml.org/xmlns/bed/1.2).

Best regards,
Fabian

Hi Fabian,

I see the problem, I'd class it a bug. Writing works fine but during
reading they seem to get left out. I've opened a ticket on github to
track this.

https://github.com/obspy/obspy/issues/2466

Any reason to not just read any namespaces, even the native ones of the
document back into extra? I don't see how the schema wouldn't allow
having e.g. http://quakeml.org/xmlns/quakeml/1.2 elements as custom
ones, even though that really might not be intended usage of the standard.

best,
Tobias

Hi Tobias,

I see the problem, I'd class it a bug. Writing works fine but during
reading they seem to get left out. I've opened a ticket on github to
track this.

https://github.com/obspy/obspy/issues/2466

It seems that it's not a bug, but rather a deliberate decision of the
developers:

https://github.com/obspy/obspy/blob/master/obspy/io/quakeml/core.py#L1009

Any reason to not just read any namespaces, even the native ones of the
document back into extra? I don't see how the schema wouldn't allow
having e.g. http://quakeml.org/xmlns/quakeml/1.2 elements as custom
ones, even though that really might not be intended usage of the standard.

You are right for the QuakeML root namespace http://quakeml.org/xmlns/quakeml/
1.2. Extensions of <eventParameters> and below (i.e. the BasicEventDescription
namespace) with elements in this namespace are valid QuakeML 1.2 and thus
these extension elements should be captured in the .extra elements.

Extension elements in the BED namespace itself (http://quakeml.org/xmlns/bed/
1.2) are per Schema definition no valid QuakeML 1.2. One can argue whether
they should be included. Given the fact that there are lots of invalid QuakeML
documents out in the wild, I correct my previous opinion and suggest to
include them, too (if it's technically feasible in the current
implementation). Elements that are placed "illegally" in http://quakeml.org/
xmlns/bed/1.2 could then at least be found in .extra, which would make life
easier for users.

Best regards,
Fabian