Klar:
Folgende Beispieldatei:
XML-Code:
<node id="282585868" lat="54.333581" lon="10.0556521" user="seawolff" visible="true" timestamp="2009-04-02T21:15:25+01:00"/>
<node id="282593609" lat="54.3312243" lon="10.0555973" user="seawolff" visible="true" timestamp="2008-08-01T00:45:03+01:00"/>
<node id="282593610" lat="54.3316107" lon="10.0557792" user="seawolff" visible="true" timestamp="2009-04-02T21:16:44+01:00"/>
<node id="282593995" lat="54.3278978" lon="10.0491929" user="seawolff" visible="true" timestamp="2009-04-02T21:14:24+01:00"/>
<node id="286368454" lat="54.3226474" lon="10.051243" user="seawolff" visible="true" timestamp="2009-01-25T20:37:17+00:00"/>
<node id="292850773" lat="54.3317324" lon="10.0547135" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
<tag k="bicycle" v="yes"/>
<tag k="barrier" v="bollard"/>
<tag k="foot" v="yes"/>
</node>
<node id="292850791" lat="54.3318193" lon="10.0547549" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
<tag k="bicycle" v="yes"/>
<tag k="barrier" v="bollard"/>
<tag k="foot" v="yes"/>
</node>
<node id="293582482" lat="54.3319214" lon="10.0520824" user="seawolff" visible="true" timestamp="2009-04-02T21:15:24+01:00"/>
<node id="293582589" lat="54.3342985" lon="10.0531553" user="seawolff" visible="true" timestamp="2009-04-02T21:15:19+01:00"/>
<node id="293582667" lat="54.3339883" lon="10.0529922" user="seawolff" visible="true" timestamp="2009-04-02T21:15:19+01:00"/>
<node id="298607138" lat="54.3338381" lon="10.0557731" user="seawolff" visible="true" timestamp="2009-04-02T21:15:23+01:00"/>
<node id="298607389" lat="54.3328038" lon="10.0552722" user="seawolff" visible="true" timestamp="2009-01-19T19:48:07+00:00"/>
<node id="303919302" lat="54.3311145" lon="10.0544303" user="seawolff" visible="true" timestamp="2009-01-19T19:48:07+00:00"/>
<node id="303919466" lat="54.3316025" lon="10.0535381" user="desc" visible="true" timestamp="2008-10-15T23:05:19+01:00"/>
<relation id="62763" visible="true" timestamp="2009-04-07T12:35:46+01:00" user="Nightdive">
<member type="way" ref="21377255" role="outer"/>
<member type="way" ref="29411574" role="outer"/>
<member type="way" ref="29413066" role="outer"/>
<member type="way" ref="32207757" role="outer"/>
<tag k="name" v="Kiel, Landeshauptstadt"/>
<tag k="de:amtlicher_gemeindeschluessel" v="01002"/>
<tag k="source" v="http://wiki.openstreetmap.org/wiki/Import/Catalogue/Kreisgrenzen_Deutschland_2005"/>
<tag k="admin_level" v="6"/>
<tag k="created_by" v="Potlatch 0.10f"/>
<tag k="type" v="multipolygon"/>
<tag k="boundary" v="administrative"/>
</relation>
<way id="27667325" visible="true" timestamp="2008-10-11T23:32:10+01:00" user="desc">
<nd ref="303856920"/>
<nd ref="303856922"/>
<nd ref="303856923"/>
<nd ref="303856924"/>
<nd ref="303856925"/>
<nd ref="303856927"/>
<nd ref="303856928"/>
<nd ref="303856929"/>
<tag k="created_by" v="Potlatch 0.10d"/>
<tag k="name" v="Helsinkistraße"/>
<tag k="maxspeed" v="30"/>
<tag k="highway" v="residential"/>
</way>
<way id="27667325" visible="true" timestamp="2008-10-11T23:32:10+01:00" user="desc">
Los gehts:
Liefert mir
XML-Code:
<node id="282585868" lat="54.333581" lon="10.0556521" user="seawolff" visible="true" timestamp="2009-04-02T21:15:25+01:00"/>
<node id="282593609" lat="54.3312243" lon="10.0555973" user="seawolff" visible="true" timestamp="2008-08-01T00:45:03+01:00"/>
<node id="282593610" lat="54.3316107" lon="10.0557792" user="seawolff" visible="true" timestamp="2009-04-02T21:16:44+01:00"/>
<node id="282593995" lat="54.3278978" lon="10.0491929" user="seawolff" visible="true" timestamp="2009-04-02T21:14:24+01:00"/>
<node id="286368454" lat="54.3226474" lon="10.051243" user="seawolff" visible="true" timestamp="2009-01-25T20:37:17+00:00"/>
<node id="292850773" lat="54.3317324" lon="10.0547135" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
<tag k="bicycle" v="yes"/>
<tag k="barrier" v="bollard"/>
<tag k="foot" v="yes"/>
</node>
Code:
<node(.*)>([^\/]*</node>|)
liefert mir jeweils immer nur eine Zeile, also bspw.
XML-Code:
<node id="282593995" lat="54.3278978" lon="10.0491929" user="seawolff" visible="true" timestamp="2009-04-02T21:14:24+01:00"/>
<node id="286368454" lat="54.3226474" lon="10.051243" user="seawolff" visible="true" timestamp="2009-01-25T20:37:17+00:00"/>
<node id="292850773" lat="54.3317324" lon="10.0547135" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
ungeachtet dem </node>-Tag.
Code:
<node[^\/]*>((.*)</node>|)
liefert mir
XML-Code:
<node id="292850773" lat="54.3317324" lon="10.0547135" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
<tag k="bicycle" v="yes"/>
<tag k="barrier" v="bollard"/>
<tag k="foot" v="yes"/>
</node>
und schließlich liefert mir noch
Code:
<node[^\/]*>([^\/]*</node>|)
den vorherigen Ausschnitt, allerdings nur die Zeile
<node id="292850773" lat="54.3317324" lon="10.0547135" user="nhoffm" visible="true" timestamp="2008-09-01T13:13:18+01:00">
Überprüfen tue ich das alles mit der Testapp aus dem TRegExpr-Paket, siehe Anhang. Dabei sind die Optionen (/i) und (/s) gesetzt.