JOSM file format
From OpenStreetMap
The JOSM file format is the basic format used by JOSM looks very much like the result of a bbox request from the server with just a few minor additions.
Note that this is both a storage format and a change file format. So in addition to storing data downloaded from the server it can also store changes made by the user since.
Example
<?xml version='1.0' encoding='UTF-8'?>
<osm version='0.4' generator='JOSM'>
<bound box='52.002540501956155,4.341671814164718,52.02533006290631,4.374151424652737' origin='http://www.openstreetmap.org/api/0.4' />
<node id='350485' timestamp='2005-12-24 17:40:15' visible='true' lat='52.0088411414041' lon='4.34174776077271' action="modify" />
<node id='-1' timestamp='2006-12-25 17:14:03' user='kleptog' visible='true' lat='52.0116274960527' lon='4.36197113456427'>
<tag k='created_by' v='JOSM' />
</node>
</osm>
The format looks almost exactly like the output from the server, with a few small changes:
- Addition of a bound tag which indicates the bounding box of the download that generated this data (if known). In addition it also has the origin tag which indicates the server the data came from.
- Entites can have an action tag which can take one of the values: modify or delete. For modify it indicates it should replace the old version of this entity.
- Creation is indicated by the use of a negative ID. This negative ID is simultaneously a placeholder value which can be used elsewhere in the file for dependant object.
Unlike some other change file formats the order of the entities is by type rather than in the actual order of the changes. The result is another self-consistant file, so it will always be possible to reorder the changes in such a way that referential integrity is preserved.

