[OSM-dev] XML Schema
Brett Henderson
brett at bretth.com
Sun Nov 9 04:48:02 GMT 2008
Frederik Ramm wrote:
> Does
>
> http://wiki.openstreetmap.org/index.php/OSM_Protocol_Version_0.5/DTD
>
> not work?
>
> You're right about the change files though, I don't know if there's
> anything for that. Then again, while it is very easy to validate your
> application's output against a DTD, it is quite difficult to validate
> the input side - whether or not your application will really be able to
> process any document allowed by the DTD!
>
Are you referring to the change files currently used by osmosis and
intended to be used for bulk uploads in 0.6? If so, the intent was that
each create/modify/delete element has an almost identical structure to
the root osm element in a normal osm file. I've never written a DTD
file before, I must be odd because I've only ever used Xml Schema ;-)
In the Xml Schema case you can define a complex type representing a set
of way/node/relation elements whose definition can be re-used in the
definition of osm/create/modify/delete element types (The relationship
between Complex Types and Elements has parallels to the relationship
between OO Classes and Objects). I don't know if DTD has such a concept
of re-use.
I've been meaning to create a schema for a long time but never got
around to it, it didn't seem like a very high priority. If people hate
Schema that much then I guess a DTD should be created for change files
instead. One nice thing about creating a schema is that it becomes
easier to use code generation tools for xml serialisation and
deserialisation.
With either DTD or Schema it should be possible to define an open ended
structure allowing for new element types and attributes to be added
without breaking existing tools. The definition just defines a
structure for those elements we know about at a point in time.
Hmm, I don't think I've added anything useful to this discussion. I'll
be quiet now :-)
More information about the dev
mailing list