XML interface update to version 1.3, see htdocs/doc/xml/xml11.html

- new caches element <wpts> for additional waypoints
- added time to logs <date> field
- renamed pictures <attributes> field to <picattr>
- added preview flag to <picattr>
- fixed errors in v1.1 and 1.2 DTDs
This commit is contained in:
following
2013-05-10 20:54:22 +02:00
parent a35c1b5d0e
commit a93c994aa9
7 changed files with 242 additions and 34 deletions

View File

@ -1403,6 +1403,10 @@
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF NEW.`type`=1 THEN IF NEW.`type`=1 THEN
IF (ISNULL(@XMLSYNC) OR @XMLSYNC!=1) THEN
/* update caches modification date for XML interface handling */
UPDATE `caches` SET `last_modified`=NEW.`last_modified` WHERE `cache_id`=NEW.`cache_id`;
END IF;
CALL sp_update_cache_listingdate(NEW.`cache_id`); CALL sp_update_cache_listingdate(NEW.`cache_id`);
END IF; END IF;
END;"); END;");
@ -1422,6 +1426,10 @@
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF NEW.`type`=1 THEN IF NEW.`type`=1 THEN
IF (ISNULL(@XMLSYNC) OR @XMLSYNC!=1) THEN
/* update caches modification date for XML interface handling */
UPDATE `caches` SET `last_modified`=NEW.`last_modified` WHERE `cache_id`=NEW.`cache_id`;
END IF;
CALL sp_update_cache_listingdate(NEW.`cache_id`); CALL sp_update_cache_listingdate(NEW.`cache_id`);
END IF; END IF;
IF OLD.`cache_id`!=NEW.`cache_id` AND OLD.`type`=1 THEN IF OLD.`cache_id`!=NEW.`cache_id` AND OLD.`type`=1 THEN
@ -1434,6 +1442,10 @@
FOR EACH ROW FOR EACH ROW
BEGIN BEGIN
IF OLD.`type`=1 THEN IF OLD.`type`=1 THEN
IF (ISNULL(@XMLSYNC) OR @XMLSYNC!=1) THEN
/* update caches modification date for XML interface handling */
UPDATE `caches` SET `last_modified`=NOW() WHERE `cache_id`=OLD.`cache_id`;
END IF;
CALL sp_update_cache_listingdate(OLD.`cache_id`); CALL sp_update_cache_listingdate(OLD.`cache_id`);
END IF; END IF;
END;"); END;");

View File

@ -3,7 +3,7 @@
<title>Dokumentation Opencaching XML-Interface Version 1.2</title> <title>Dokumentation Opencaching XML-Interface Version 1.2</title>
<meta name="vs_showGrid" content="True"> <meta name="vs_showGrid" content="True">
</head> </head>
<body> <body style="font-family: arial, sans-serif, Tahoma, Verdana; font-size:12px">
<h1>Dokumentation Opencaching XML-Interface Version 1.2</h1> <h1>Dokumentation Opencaching XML-Interface Version 1.2</h1>
<p> <p>
Das XML-Interface dient zum automatisierten abfragen aller Caches, Logeinträge, Das XML-Interface dient zum automatisierten abfragen aller Caches, Logeinträge,
@ -23,7 +23,7 @@
<span style="color:red">The downloaded data is copyrighted and must only be used under the terms of <a href="http://www.opencaching.de/articles.php?page=impressum&locale=EN#datalicense">Opencaching.de data license</a>.</span></em> <span style="color:red">The downloaded data is copyrighted and must only be used under the terms of <a href="http://www.opencaching.de/articles.php?page=impressum&locale=EN#datalicense">Opencaching.de data license</a>.</span></em>
</p> </p>
<h2>Änderungen in Version 1.2</h2> <h2>Änderungen in Version 1.2 (Februar 2013)</h2>
<ul> <ul>
<li>neues Attribut <em>ispublishdate</em> bei cache.datecreated</li> <li>neues Attribut <em>ispublishdate</em> bei cache.datecreated</li>
<li>Ausgabe von Nano-Cachgrößen</li> <li>Ausgabe von Nano-Cachgrößen</li>
@ -38,6 +38,14 @@
</li> </li>
</ul> </ul>
<h2>Änderungen in Version 1.3 (Mai 2013)</h2>
<ul>
<li>Zusätzliche Wegpunkte von Caches werden nun in einer &lt;wpts&gt;...&lt;/wpts&gt;-Liste mitgeliefert.</li>
<li>Das &lt;date&gt;-Element von Logs enthält nun auch die Uhrzeit. 00:00:00 bedeutet, dass keine Uhrzeit geloggt wurde; alles andere bedeutet, dass mit Stunde und Minute geloggt wurde.</li>
<li>Element für Bildeigenschaften von &lt;attributes&gt; in &lt;picattr&gt; umbenannt, um Kollisionen mit dem Cache-Attribut-Element zu vermeiden.</li>
<li>Vorschaubild-Flag (<em>preview</em>) zu &lt;picattr&gt; hinzugefügt.</li>
</ul>
<p>Der XML-Doctype lautet in allen Versionen "oc11xml".</p> <p>Der XML-Doctype lautet in allen Versionen "oc11xml".</p>
<h2>Ausgabeformat</h2> <h2>Ausgabeformat</h2>
<p> <p>
@ -137,9 +145,13 @@
&nbsp; &lt;datecreated ispublishdate="0"&gt;2005-09-08 15:45:02&lt;/datecreated&gt;<br> &nbsp; &lt;datecreated ispublishdate="0"&gt;2005-09-08 15:45:02&lt;/datecreated&gt;<br>
&nbsp; &lt;lastmodified&gt;2005-12-20 20:58:41&lt;/lastmodified&gt;<br> &nbsp; &lt;lastmodified&gt;2005-12-20 20:58:41&lt;/lastmodified&gt;<br>
&nbsp; &lt;attributes&gt;<br> &nbsp; &lt;attributes&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&lt;attribute id="6"&gt;&lt;![CDATA[ Nur bei Opencaching]]&gt;&lt;/attribute&gt;<br> &nbsp;&nbsp;&nbsp;&nbsp;&lt;attribute id="6"&gt;&lt;![CDATA[Nur bei Opencaching]]&gt;&lt;/attribute&gt;<br>
&nbsp; &lt;/attributes&gt;<br> &nbsp; &lt;/attributes&gt;<br>
&lt;/cache&gt;</P> &nbsp; &lt;wpts&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;wpt id="25" type="1" typename="Parking" longitude="8.01667" latitude="50.00000"&gt;&lt;![CDATA[Parkplatz, von hier 1 km Fußweg]]&gt;&lt;/wpt&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;wpt id="26" type="2" typename="Stage or reference point" longitude="8.02333" latitude="50.01544"&gt;&lt;![CDATA[Station 1]]&gt;&lt;/wpt&gt;<br />
&nbsp; &lt;/wpts&gt;<br />
&lt;/cache&gt;</p>
<p><em>lastmodified</em> ist das letzte Änderungsdatum des cache-Datensatzes, ohne Änderungen an Cachebeschreibungen oder Bildern. Für das Gesamt-Änderungsdatum des Listings müssen Letztere also mit "eingerechnet" werden. Ein Gesamt-Änderungsdatum des Listings kann bei Bedarf eingebaut werden.</p> <p><em>lastmodified</em> ist das letzte Änderungsdatum des cache-Datensatzes, ohne Änderungen an Cachebeschreibungen oder Bildern. Für das Gesamt-Änderungsdatum des Listings müssen Letztere also mit "eingerechnet" werden. Ein Gesamt-Änderungsdatum des Listings kann bei Bedarf eingebaut werden.</p>
<p><em>datecreated</em> ist bei mit OC Version 1 und 2 angelegten Caches das Datum, an dem das Listing angelegt wurde, bei mit Version 3 angelegten Caches das Veröffentlichungsdatum. Ab Interface Version 1.2 zeigt das Attribut <em>ispublishdate="1"</em> an, dass es sich um das Veröffentlichungsdatum handelt.</p> <p><em>datecreated</em> ist bei mit OC Version 1 und 2 angelegten Caches das Datum, an dem das Listing angelegt wurde, bei mit Version 3 angelegten Caches das Veröffentlichungsdatum. Ab Interface Version 1.2 zeigt das Attribut <em>ispublishdate="1"</em> an, dass es sich um das Veröffentlichungsdatum handelt.</p>
<p>Ab XML-Version 1.2 werden im <em>size</em>-Feld auch Nano-Größen zurückgeliefert. In älteren Interface-Versionen wird stattdessen "micro" ausgegeben.</p> <p>Ab XML-Version 1.2 werden im <em>size</em>-Feld auch Nano-Größen zurückgeliefert. In älteren Interface-Versionen wird stattdessen "micro" ausgegeben.</p>
@ -176,7 +188,7 @@
uuid="CAA9E3C5-50DF-4E9E-191F-CECABA6A8A19"&gt;&lt;![CDATA[Team uuid="CAA9E3C5-50DF-4E9E-191F-CECABA6A8A19"&gt;&lt;![CDATA[Team
Schnitzeljagd]]&gt;&lt;/user&gt;<BR> Schnitzeljagd]]&gt;&lt;/user&gt;<BR>
&nbsp; &lt;logtype id="1" recommended="0"&gt;&lt;![CDATA[Gefunden]]&gt;&lt;/type&gt;<br> &nbsp; &lt;logtype id="1" recommended="0"&gt;&lt;![CDATA[Gefunden]]&gt;&lt;/type&gt;<br>
&nbsp; &lt;date&gt;2005-05-18&lt;/date&gt;<br> &nbsp; &lt;date&gt;2005-05-18 16:20:00&lt;/date&gt;<br>
&nbsp; &lt;text&gt;&lt;![CDATA[Gut gefunden.&amp;lt;br /&amp;gt;<br> &nbsp; &lt;text&gt;&lt;![CDATA[Gut gefunden.&amp;lt;br /&amp;gt;<br>
Gr&amp;uuml;&amp;szlig;e von&amp;lt;br /&amp;gt;<br> Gr&amp;uuml;&amp;szlig;e von&amp;lt;br /&amp;gt;<br>
Volker]]&gt;&lt;/text&gt;<br> Volker]]&gt;&lt;/text&gt;<br>
@ -193,10 +205,8 @@
&nbsp; &lt;title&gt;&lt;![CDATA[Schlurfende Gestalten]]&gt;&lt;/title&gt;<br> &nbsp; &lt;title&gt;&lt;![CDATA[Schlurfende Gestalten]]&gt;&lt;/title&gt;<br>
&nbsp; &lt;desc html="0"&gt;&lt;/desc&gt;<br> &nbsp; &lt;desc html="0"&gt;&lt;/desc&gt;<br>
&nbsp; &lt;object id="73240" type="1" typename= &nbsp; &lt;object id="73240" type="1" typename=
"cachelog"&gt;4FE4B999-315D-43C1-11C2-2B81E68168CD&lt;/object&gt;<BR> "cachelog"&gt;4FE4B999-315D-43C1-11C2-2B81E68168CD&lt;/object&gt;<br>
<SPAN class="m">&nbsp; &lt;</SPAN><SPAN class="t">attributes</SPAN> &nbsp; &lt;picattr spoiler="0" display="1" preview="0" /&gt;<br>
<SPAN class="t">spoiler</SPAN><SPAN class="m">="</SPAN>0<SPAN class="m">"</SPAN><SPAN class="t"> display</SPAN><SPAN class="m">="</SPAN>1<SPAN class="m">"</SPAN><SPAN class="m"> /&gt;&lt; /SPAN&gt;
<br>
&nbsp; &lt;datecreated&gt;2005-12-24 01:01:38&lt;/datecreated&gt;<br> &nbsp; &lt;datecreated&gt;2005-12-24 01:01:38&lt;/datecreated&gt;<br>
&nbsp; &lt;lastmodified&gt;2005-12-24 01:01:38&lt;/lastmodified&gt;<br> &nbsp; &lt;lastmodified&gt;2005-12-24 01:01:38&lt;/lastmodified&gt;<br>
&lt;/picture&gt; &lt;/picture&gt;
@ -259,20 +269,20 @@
<p>Paramter uuid ... wie cacheid, ausser dass statt der cacheid die UUID des Caches verwendet wird.</p> <p>Paramter uuid ... wie cacheid, ausser dass statt der cacheid die UUID des Caches verwendet wird.</p>
<h3>Beispiele</h3> <h3>Beispiele</h3>
<p>1. Alle Daten inkrementell abrufen<br/> <p>1. Alle Daten inkrementell abrufen<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1</a></p>
<p>2. Alle Daten von Deutschland inkrementell abrufen<br/> <p>2. Alle Daten von Deutschland inkrementell abrufen<br/>
<A>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=0&amp;country=DE&amp;picturefromcachelog=1</a></p> <A>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=0&amp;country=DE&amp;picturefromcachelog=1</a></p>
<p>3. Alle Caches ohne Logs von Deutschland inkrementell abrufen<br/> <p>3. Alle Caches ohne Logs von Deutschland inkrementell abrufen<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;picture=1&amp;removedobject=0&amp;country=DE</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;picture=1&amp;removedobject=0&amp;country=DE</a></p>
<p>4. Alle Daten im Umkreis von 15 km abrufen<br/> <p>4. Alle Daten im Umkreis von 15 km abrufen<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=0&amp;lat=48&amp;lon=9&amp;distance=15&amp;picturefromcachelog=1</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=0&amp;lat=48&amp;lon=9&amp;distance=15&amp;picturefromcachelog=1</a></p>
<p>5. Alle Bilder abrufen<br/> <p>5. Alle Bilder abrufen<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;picture=1</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;picture=1</a></p>
<p>6. Alle Bilder von Caches abrufen die in Deutschland versteckt sind<br/> <p>6. Alle Bilder von Caches abrufen die in Deutschland versteckt sind<br/>
<a>http://www.opencaching.de/xml/ocxml2.php?modifiedsince=&lt;date&gt;&amp;picture=1&amp;country=DE</a></p> <a>http://www.opencaching.de/xml/ocxml2.php?modifiedsince=&lt;date&gt;&amp;picture=1&amp;country=DE</a></p>
<p>7. Alle Bilder von Caches und deren Logs abrufen die in Deutschland versteckt <p>7. Alle Bilder von Caches und deren Logs abrufen die in Deutschland versteckt
sind<br/> sind<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;picture=1&amp;country=DE</a>&amp;picturefromcachelog=1</p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;picture=1&amp;country=DE</a>&amp;picturefromcachelog=1</p>
<p>Mit ocxml11.php kann stattdessen die Interface-Version 1.1 verwendet werden.</p> <p>Mit ocxml11.php kann stattdessen die Interface-Version 1.1 verwendet werden.</p>
<p>Diese Anfragen werden mit einem kurzen XML-Stream beantwortet, der die <p>Diese Anfragen werden mit einem kurzen XML-Stream beantwortet, der die
XML-Session-Id zurückgibt. Mit dieser Id können dann die Daten abgerufen XML-Session-Id zurückgibt. Mit dieser Id können dann die Daten abgerufen
@ -288,9 +298,9 @@
Summe der Datensätze ist in diesem Beispiel 1205 - es werden also 3 Aufrufe Summe der Datensätze ist in diesem Beispiel 1205 - es werden also 3 Aufrufe
benötigt (500, 500, 205 Datensätze).</p> benötigt (500, 500, 205 Datensätze).</p>
<p>Die Daten können dann mit folgender Anfrage abgerufen werden:<br/> <p>Die Daten können dann mit folgender Anfrage abgerufen werden:<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?sessionid=12345&amp;file=1</a><br/> <a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&amp;file=1</a><br/>
<a>http://www.opencaching.de/xml/ocxml12.php?sessionid=12345&amp;file=2</a><br/> <a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&amp;file=2</a><br/>
<a>http://www.opencaching.de/xml/ocxml12.php?sessionid=12345&amp;file=3</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&amp;file=3</a></p>
<p>Die Sessionid ist zwei Stunden lang gültig, wobei sich dieser Zeitraum mit jedem <p>Die Sessionid ist zwei Stunden lang gültig, wobei sich dieser Zeitraum mit jedem
einzelnen Dateiabruf verlängert &ndash; zwischen den Einzelabrufen dürfen also einzelnen Dateiabruf verlängert &ndash; zwischen den Einzelabrufen dürfen also
maximal zwei Stunden vergehen. Dauert es länger, müsste eine neue sessionid maximal zwei Stunden vergehen. Dauert es länger, müsste eine neue sessionid
@ -299,14 +309,14 @@
<p>Um alle Ergebnisse in einer Datei abzurufen muss bei dem Aufruf der Paramter <p>Um alle Ergebnisse in einer Datei abzurufen muss bei dem Aufruf der Paramter
session auf 0 gesetzt werden.</p> session auf 0 gesetzt werden.</p>
<p>Beispeil:<br/> <p>Beispeil:<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1&amp;session=0</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1&amp;session=0</a></p>
<h3>Dateikomprimierung einstellen</h3> <h3>Dateikomprimierung einstellen</h3>
<p>Dei Dateikomprimierung kann mit dem Paramter zip eingestellt weren. Mögliche <p>Dei Dateikomprimierung kann mit dem Paramter zip eingestellt weren. Mögliche
Werte sind 0, zip, bzip2, gzip. Null bedeutet hier keine Kompression. Wird Werte sind 0, zip, bzip2, gzip. Null bedeutet hier keine Kompression. Wird
keine Kompression angegeben, wird zip verwendet.</p> keine Kompression angegeben, wird zip verwendet.</p>
<p>Beispeil:<br/> <p>Beispeil:<br/>
<a>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1&amp;session=0&amp;zip=bzip2</a><br/> <a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=&lt;date&gt;&amp;user=1&amp;cache=1&amp;cachedesc=1&amp;cachelog=1&amp;picture=1&amp;removedobject=1&amp;session=0&amp;zip=bzip2</a><br/>
<a>http://www.opencaching.de/xml/ocxml12.php?sessionid=12345&amp;file=1&amp;zip=gzip</a></p> <a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&amp;file=1&amp;zip=gzip</a></p>
<h3>XML-Optionen</h3> <h3>XML-Optionen</h3>
<p>Die folgenden XML-Optionen müssen bei jedem Aufruf übergeben <p>Die folgenden XML-Optionen müssen bei jedem Aufruf übergeben
werden.</p> werden.</p>
@ -320,8 +330,8 @@
charset ... (Default) iso-8859-1 / utf-8<br /> charset ... (Default) iso-8859-1 / utf-8<br />
attrlist ... (Default) 0 = keine Attributliste &uuml;bertragen / 1 = Attributliste &uuml;bertragen</p> attrlist ... (Default) 0 = keine Attributliste &uuml;bertragen / 1 = Attributliste &uuml;bertragen</p>
<h4><a>Beispiele</a></h4> <h4><a>Beispiele</a></h4>
<p>http://www.opencaching.de/xml/ocxml12.php?modifiedsince=20060320000000&amp;user=1&amp;cache=1&amp;cachelog=1&amp;cachedesc=1&amp;picture=1&amp;removedobject=1&amp;session=1&amp;charset=utf-8&amp;cdata=1&amp;xmldecl=0&amp;ocxmltag=0&amp;doctype=0<br/> <p>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=20060320000000&amp;user=1&amp;cache=1&amp;cachelog=1&amp;cachedesc=1&amp;picture=1&amp;removedobject=1&amp;session=1&amp;charset=utf-8&amp;cdata=1&amp;xmldecl=0&amp;ocxmltag=0&amp;doctype=0<br/>
http://www.opencaching.de/xml/ocxml12.php?sessionid=4711&amp;file=1&amp;charset=utf-8&amp;cdata=1&amp;xmldecl=0&amp;ocxmltag=0&amp;doctype=0</p> http://www.opencaching.de/xml/ocxml13.php?sessionid=4711&amp;file=1&amp;charset=utf-8&amp;cdata=1&amp;xmldecl=0&amp;ocxmltag=0&amp;doctype=0</p>
<h3>Sonstige Anmerkungen</h3> <h3>Sonstige Anmerkungen</h3>
<ul> <ul>
<li> <li>
@ -347,7 +357,7 @@
<h3>Ressourcen</h3> <h3>Ressourcen</h3>
<ul> <ul>
<li>Das XML-Dokument enthält folgende DTD (Document Type Definition): <li>Das XML-Dokument enthält folgende DTD (Document Type Definition):
http://www.opencaching.de/xml/ocxml11.dtd (Version 1.1) bzw. http://www.opencaching.de/xml/ocxml12.dtd (Version 1.2)</li> http://www.opencaching.de/xml/ocxmlXX.dtd mit XX = Versionummer, z.B. ocxml12.dtd für Version 1.2.</li>
<li>Der Quellcode ist hier erhältlich: <a href="https://github.com/OpencachingDeutschland/oc-server3/tree/stable/htdocs/xml"> <li>Der Quellcode ist hier erhältlich: <a href="https://github.com/OpencachingDeutschland/oc-server3/tree/stable/htdocs/xml">
https://github.com/OpencachingDeutschland/oc-server3/tree/stable/htdocs/xml</a></li> https://github.com/OpencachingDeutschland/oc-server3/tree/stable/htdocs/xml</a></li>
<li>Eine Referenzimplementierung kann hier heruntergeladen werden: <li>Eine Referenzimplementierung kann hier heruntergeladen werden:

View File

@ -104,6 +104,9 @@
> >
<!ELEMENT date (#PCDATA)> <!ELEMENT date (#PCDATA)>
<!ELEMENT text (#PCDATA)> <!ELEMENT text (#PCDATA)>
<!ATTLIST text
html CDATA #REQUIRED
>
<!-- picture --> <!-- picture -->
<!ELEMENT url (#PCDATA)> <!ELEMENT url (#PCDATA)>

View File

@ -486,7 +486,11 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
fwrite($f, $t2 . '<datecreated' . $pd . '>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n"); fwrite($f, $t2 . '<datecreated' . $pd . '>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n"); fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
$rsAttributes = sql("SELECT `cache_attrib`.`id`, `cache_attrib`.`name` FROM `caches_attributes` INNER JOIN `cache_attrib` ON `caches_attributes`.`attrib_id`=`cache_attrib`.`id` WHERE `caches_attributes`.`cache_id`='&1'", $r['id']); $rsAttributes = sql("SELECT `cache_attrib`.`id`, `cache_attrib`.`name`
FROM `caches_attributes`
INNER JOIN `cache_attrib` ON `caches_attributes`.`attrib_id`=`cache_attrib`.`id`
WHERE `caches_attributes`.`cache_id`='&1'",
$r['id']);
fwrite($f, $t2 . '<attributes>' . "\n"); fwrite($f, $t2 . '<attributes>' . "\n");
while ($rAttribute = sql_fetch_assoc($rsAttributes)) while ($rAttribute = sql_fetch_assoc($rsAttributes))
{ {
@ -495,10 +499,23 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
fwrite($f, $t2 . '</attributes>' . "\n"); fwrite($f, $t2 . '</attributes>' . "\n");
sql_free_result($rsAttributes); sql_free_result($rsAttributes);
// If additional waypoints are added here, last_modified date handling must be changed if ($ocxmlversion >= 13)
// to include also max(last_modified) of all waypoints: either set caches.last_modified via {
// coordinates trigger, or - better - check coordinates.last_modified when constructing $rsWaypoints = sql("SELECT `co`.`id`, `co`.`subtype` AS `type`,
// xml session data. `co`.`latitude`, `co`.`longitude`, `co`.`description`,
`ct`.`name` AS `type_name`
FROM `coordinates` `co`
INNER JOIN `coordinates_type` `ct` ON `ct`.`id`=`co`.`subtype`
WHERE `cache_id`='&1' AND `type`=1
ORDER BY `co`.`id` ASC", $r['id']);
fwrite($f, $t2 . '<wpts>' . "\n");
while ($rWaypoint = sql_fetch_assoc($rsWaypoints))
{
fwrite($f, $t3 . '<wpt id="' . ($rWaypoint['id']+0) . '" type="' . ($rWaypoint['type']+0) . '" typename="' . xmlentities($rWaypoint['type_name']) . '" longitude="' . sprintf('%01.5f',$rWaypoint['longitude']) . '" latitude="' . sprintf('%01.5f',$rWaypoint['latitude']) . '">' . xmlcdata($rWaypoint['description']) . '</wpt>' . "\n");
}
fwrite($f, $t2 . '</wpts>' . "\n");
sql_free_result($rsAttributes);
}
fwrite($f, $t1 . '</cache>' . "\n"); fwrite($f, $t1 . '</cache>' . "\n");
} }
@ -579,7 +596,7 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
fwrite($f, $t2 . '<cacheid id="' . $r['cache_id'] . '">' . $r['cacheuuid'] . '</cacheid>' . "\n"); fwrite($f, $t2 . '<cacheid id="' . $r['cache_id'] . '">' . $r['cacheuuid'] . '</cacheid>' . "\n");
fwrite($f, $t2 . '<userid id="' . $r['user_id'] . '" uuid="' . $r['useruuid'] . '">' . xmlcdata($r['username']) . '</userid>' . "\n"); fwrite($f, $t2 . '<userid id="' . $r['user_id'] . '" uuid="' . $r['useruuid'] . '">' . xmlcdata($r['username']) . '</userid>' . "\n");
fwrite($f, $t2 . '<logtype id="' . $r['type'] . '" recommended="' . $r['recommended'] . '">' . xmlcdata($logtypes[$r['type']]) . '</logtype>' . "\n"); fwrite($f, $t2 . '<logtype id="' . $r['type'] . '" recommended="' . $r['recommended'] . '">' . xmlcdata($logtypes[$r['type']]) . '</logtype>' . "\n");
fwrite($f, $t2 . '<date>' . date($sDateshort, strtotime($r['date'])) . '</date>' . "\n"); fwrite($f, $t2 . '<date>' . date($ocxmlversion >= 13 ? $sDateformat : $sDateshort, strtotime($r['date'])) . '</date>' . "\n");
fwrite($f, $t2 . '<text html="' . $r['text_html'] . '">' . xmlcdata(($bAllowView ? $r['text'] : '')) . '</text>' . "\n"); fwrite($f, $t2 . '<text html="' . $r['text_html'] . '">' . xmlcdata(($bAllowView ? $r['text'] : '')) . '</text>' . "\n");
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n"); fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n"); fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
@ -600,6 +617,7 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
`pictures`.`date_created` `date_created`, `pictures`.`uuid` `uuid`, `pictures`.`date_created` `date_created`, `pictures`.`uuid` `uuid`,
`pictures`.`last_modified` `last_modified`, `pictures`.`display` `display`, `pictures`.`last_modified` `last_modified`, `pictures`.`display` `display`,
`pictures`.`spoiler` `spoiler`, `pictures`.`node` `node`, `pictures`.`spoiler` `spoiler`, `pictures`.`node` `node`,
`pictures`.`mappreview`,
IFNULL(`c1`.`cache_id`,`c2`.`cache_id`) AS `cache_id`, IFNULL(`c1`.`cache_id`,`c2`.`cache_id`) AS `cache_id`,
IFNULL(`c1`.`country`,`c2`.`country`) AS `language`, /* hack */ IFNULL(`c1`.`country`,`c2`.`country`) AS `language`, /* hack */
IFNULL(`cs1`.`allow_user_view`, `cs2`.`allow_user_view`) AS `auv`, IFNULL(`cs1`.`allow_user_view`, `cs2`.`allow_user_view`) AS `auv`,
@ -624,7 +642,10 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
fwrite($f, $t2 . '<url>' . xmlcdata(($bAllowView ? $r['url'] : '')) . '</url>' . "\n"); fwrite($f, $t2 . '<url>' . xmlcdata(($bAllowView ? $r['url'] : '')) . '</url>' . "\n");
fwrite($f, $t2 . '<title>' . xmlcdata(($bAllowView ? $r['title'] : '')) . '</title>' . "\n"); fwrite($f, $t2 . '<title>' . xmlcdata(($bAllowView ? $r['title'] : '')) . '</title>' . "\n");
fwrite($f, $t2 . '<object id="' . $r['object_id'] . '" type="' . $r['object_type'] . '" typename="' . xmlentities($objecttypes[$r['object_type']]) . '">' . object_id2uuid($r['object_id'], $r['object_type']) . '</object>' . "\n"); fwrite($f, $t2 . '<object id="' . $r['object_id'] . '" type="' . $r['object_type'] . '" typename="' . xmlentities($objecttypes[$r['object_type']]) . '">' . object_id2uuid($r['object_id'], $r['object_type']) . '</object>' . "\n");
fwrite($f, $t2 . '<attributes spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" />' . "\n"); if ($ocxmlversion >= 13)
fwrite($f, $t2 . '<picattr spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" preview="' . $r['mappreview'] . '" />' . "\n");
else
fwrite($f, $t2 . '<attributes spoiler="' . $r['spoiler'] . '" display="' . $r['display'] . '" />' . "\n");
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n"); fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n"); fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");

View File

@ -8,9 +8,9 @@
<!ELEMENT attrlist (attr*)> <!ELEMENT attrlist (attr*)>
<!ELEMENT user (id, username, pmr, datecreated, lastmodified)> <!ELEMENT user (id, username, pmr, datecreated, lastmodified)>
<!ELEMENT cache (id, userid, name, longitude, latitude, type, status, country, size, desclanguages, difficulty, terrain, rating, waypoints, datehidden, datecreated, lastmodified)> <!ELEMENT cache (id, userid, name, longitude, latitude, type, status, country, size, desclanguages, difficulty, terrain, rating, waypoints, datehidden, datecreated, lastmodified)>
<!ELEMENT cachedesc (id, cacheid, language, shortdesc, desc, hint, license, lastmodified)> <!ELEMENT cachedesc (id, cacheid, language, shortdesc, desc, hint, license?, lastmodified)>
<!ELEMENT cachelog (id, cacheid, userid, logtype, date, text, license, datecreated, lastmodified)> <!ELEMENT cachelog (id, cacheid, userid, logtype, date, text, license?, datecreated, lastmodified)>
<!ELEMENT picture (id, url, title, object, attributes, datecreated, lastmodified)> <!ELEMENT picture (id, url, title, object, attributes, license?, datecreated, lastmodified)>
<!ELEMENT removedobject (id, object, removeddate)> <!ELEMENT removedobject (id, object, removeddate)>
<!-- common elements --> <!-- common elements -->
@ -24,6 +24,7 @@
ispublishdate CDATA #IMPLIED ispublishdate CDATA #IMPLIED
> >
<!ELEMENT lastmodified (#PCDATA)> <!ELEMENT lastmodified (#PCDATA)>
<!ELEMENT license (#PCDATA)>
<!-- attrlist --> <!-- attrlist -->
<!ELEMENT attr (#PCDATA)> <!ELEMENT attr (#PCDATA)>

147
htdocs/xml/ocxml13.dtd Normal file
View File

@ -0,0 +1,147 @@
<!ELEMENT oc11xml (attrlist*, user*, cache*, cachedesc*, cachelog*, picture*, removedobject*)>
<!ATTLIST oc11xml
version CDATA #REQUIRED
date CDATA #REQUIRED
since CDATA #REQUIRED
>
<!ELEMENT attrlist (attr*)>
<!ELEMENT user (id, username, pmr, datecreated, lastmodified)>
<!ELEMENT cache (id, userid, name, longitude, latitude, type, status, country, size, desclanguages, difficulty, terrain, rating, waypoints, datehidden, datecreated, lastmodified, attributes, wpts)>
<!ELEMENT cachedesc (id, cacheid, language, shortdesc, desc, hint, license?, lastmodified)>
<!ELEMENT cachelog (id, cacheid, userid, logtype, date, text, license?, datecreated, lastmodified)>
<!ELEMENT picture (id, url, title, object, picattr, license?, datecreated, lastmodified)>
<!ELEMENT removedobject (id, object, removeddate)>
<!-- common elements -->
<!ELEMENT id (#PCDATA)>
<!ATTLIST id
id CDATA #IMPLIED
node CDATA #IMPLIED
>
<!ELEMENT datecreated (#PCDATA)>
<!ATTLIST datecreated
ispublishdate CDATA #IMPLIED
>
<!ELEMENT lastmodified (#PCDATA)>
<!ELEMENT license (#PCDATA)>
<!-- attrlist -->
<!ELEMENT attr (#PCDATA)>
<!ATTLIST attr
id CDATA #REQUIRED
icon_large CDATA #REQUIRED
icon_no CDATA #REQUIRED
icon_undef CDATA #REQUIRED
>
<!-- user -->
<!ELEMENT username (#PCDATA)>
<!ELEMENT pmr (#PCDATA)>
<!-- cache -->
<!ELEMENT userid (#PCDATA)>
<!ATTLIST userid
id CDATA #IMPLIED
uuid CDATA #REQUIRED
>
<!ELEMENT name (#PCDATA)>
<!ELEMENT latitude (#PCDATA)>
<!ELEMENT longitude (#PCDATA)>
<!ELEMENT type (#PCDATA)>
<!ATTLIST type
id CDATA #REQUIRED
short CDATA #IMPLIED
>
<!ELEMENT status (#PCDATA)>
<!ATTLIST status
id CDATA #REQUIRED
>
<!ELEMENT country (#PCDATA)>
<!ATTLIST country
id CDATA #REQUIRED
>
<!ELEMENT size (#PCDATA)>
<!ATTLIST size
id CDATA #REQUIRED
>
<!ELEMENT desclanguages (#PCDATA)>
<!ELEMENT difficulty (#PCDATA)>
<!ELEMENT terrain (#PCDATA)>
<!ELEMENT rating (#PCDATA)>
<!ATTLIST rating
waylength CDATA #REQUIRED
needtime CDATA #REQUIRED
>
<!ELEMENT waypoints (#PCDATA)>
<!ATTLIST waypoints
gccom CDATA #IMPLIED
nccom CDATA #IMPLIED
oc CDATA #REQUIRED
>
<!ELEMENT datehidden (#PCDATA)>
<!ELEMENT attributes (attribute*)>
<!ELEMENT attribute (#PCDATA)>
<!ATTLIST attribute
id CDATA #REQUIRED
>
<!ELEMENT wpts (wpt*)>
<!ELEMENT wpt (#PCDATA)>
<!ATTLIST wpt
id CDATA #REQUIRED
type CDATA #REQUIRED
typename CDATA #IMPLIED
longitude CDATA #REQUIRED
latitude CDATA #REQUIRED
>
<!-- cachedesc -->
<!ELEMENT cacheid (#PCDATA)>
<!ATTLIST cacheid
id CDATA #IMPLIED
>
<!ELEMENT language (#PCDATA)>
<!ATTLIST language
id CDATA #REQUIRED
>
<!ELEMENT shortdesc (#PCDATA)>
<!ELEMENT desc (#PCDATA)>
<!ATTLIST desc
html CDATA #REQUIRED
>
<!ELEMENT hint (#PCDATA)>
<!-- cachelog -->
<!-- cacheid see cachedesc -->
<!-- userid see cache -->
<!ELEMENT logtype (#PCDATA)>
<!ATTLIST logtype
id CDATA #REQUIRED
recommended CDATA #IMPLIED
>
<!ELEMENT date (#PCDATA)>
<!ELEMENT text (#PCDATA)>
<!ATTLIST text
html CDATA #REQUIRED
>
<!-- picture -->
<!ELEMENT url (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT object (#PCDATA)>
<!ATTLIST object
id CDATA #IMPLIED
type CDATA #REQUIRED
typename CDATA #IMPLIED
>
<!ELEMENT picattr (#PCDATA)>
<!ATTLIST picattr
spoiler CDATA #IMPLIED
display CDATA #REQUIRED
preview CDATA #IMPLIED
>
<!-- removedobject -->
<!-- object see picture -->
<!ELEMENT removeddate (#PCDATA)>

14
htdocs/xml/ocxml13.php Normal file
View File

@ -0,0 +1,14 @@
<?php
/***************************************************************************
./xml/ocxml12.php
For license information see doc/license.txt
Unicode Reminder メモ
***************************************************************************/
$ocxmlversion = 13;
include("ocxml11.php");
?>