[webservices] A question of location ID, how to represent empty IDs in XML?

Joachim Saul saul at gfz-potsdam.de
Thu Jul 31 00:33:08 PDT 2014


Chad Trabant wrote on 31.07.2014 08:49:
>> In terms of existing StationXML parsers I assume most are just stripping whitespaces from the location code and thus “”  and “  “ should already work resulting in minimal disruption in the users’ workflows.
>
> Actually, this does not appear to be happening, in the parsers I’ve used the whitespaces are not stripped.  I have read through the XML specifications until my eyes were crossed to try and understand why this would be the case.  Then I wrote some test cases and observed no trimming, see test data and code below.  Perhaps this attribute is CDATA for some reason?  I think we are stuck with the fact that empty string and two spaces are different.

There may be parsers that do strip whitespaces, but I also doubt that this is required by any standard.

> Has anyone observed this automatic trimming on any system?

No, and I agree that a generic parser should return a raw string as it is in the XML without implicit trimming, nullifying etc. To obtain a trimmed string, it's trivial to trim() the input strings as needed. That's what's done in ObsPy, too.

In fact even the *already* empty string location codes from libmseed are trimmed again at ObsPy level, just in case. ;)

>> “--“ would require software to be updated and looks a little bit weird in my opinion and unsuspecting users might interpret it as an invalid location code.
>
> Yes, it would require software changes, the question is would what we gain be worth it.  Maybe it looks a little weird, but it is already becoming synonymous in the minds of many because "--" is used for *selecting* the empty SEED location IDs.

The software changes are just one aspect. In fact, software changes are trivial compared to the nightmare of changing the existing metadata in databases, decades of SEED data, parametric data and so on.

Joachim


More information about the webservices mailing list