[OSM-dev] Parsing OSM-XML: Order of node / way / relation
Daniel Silverstone
dsilvers at digital-scurf.org
Wed Sep 24 14:51:33 BST 2008
On Wed, 2008-09-24 at 15:41 +0200, Dominik Spies wrote:
> If I can not, I would appreciate any help how I can do this efficiently?
If you encounter a node, and you can't find it in your
already-parsed-nodes list, create a new node object with that ID, stuff
it into the list, and also stuff it into a table of nodes which were
referenced but not defined.
Then when you encounter a <node> tag, look it up in the
ref-but-not-defined table, if it's there, fill it in and remove it from
that table (so it's just in the main nodes list), otherwise make a new
one for it and just put it in your normal node table.
At the end of the XML, if the ref-but-not-defined table is non-empty,
report an error.
D.
--
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895
More information about the dev
mailing list