X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/d396505786ce3be105249c740e0d3365beb4ef10..88eaf7fb94a112350c954cc6dd7e34b3408d461a:/lib/template/search-xml.php diff --git a/lib/template/search-xml.php b/lib/template/search-xml.php index f8e054e3..68d985f3 100644 --- a/lib/template/search-xml.php +++ b/lib/template/search-xml.php @@ -1,88 +1,127 @@ \n"; - - echo "\n"; - - foreach($aSearchResults as $iResNum => $aResult) - { - echo ""; - foreach($aResult['address'] as $sKey => $sValue) - { - $sKey = str_replace(' ','_',$sKey); - echo "<$sKey>"; - echo htmlspecialchars($sValue); - echo ""; - } - - echo ""; - } - else - { - echo "/>"; - } - } - - echo ""; +header('content-type: text/xml; charset=UTF-8'); + +echo '<'; +echo '?xml version="1.0" encoding="UTF-8" ?'; +echo ">\n"; + +echo '<'; +echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults'); +echo " timestamp='".date(DATE_RFC822)."'"; +echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'"; +echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'"; +if (isset($aMoreParams['viewbox'])) echo " viewbox='".htmlspecialchars($aMoreParams['viewbox'], ENT_QUOTES)."'"; +if (isset($aMoreParams['exclude_place_ids'])) { + echo " exclude_place_ids='".htmlspecialchars($aMoreParams['exclude_place_ids'])."'"; +} +echo " more_url='".htmlspecialchars($sMoreURL)."'"; +echo ">\n"; + +foreach ($aSearchResults as $iResNum => $aResult) { + echo "'; + } + echo "\n"; + echo $aResult['askml']; + echo ''; + } + + if (isset($aResult['sExtraTags'])) { + if (!$bHasDelim) { + $bHasDelim = true; + echo '>'; + } + echo "\n"; + foreach ($aResult['sExtraTags'] as $sKey => $sValue) { + echo ''; + } + echo ''; + } + + if (isset($aResult['sNameDetails'])) { + if (!$bHasDelim) { + $bHasDelim = true; + echo '>'; + } + echo "\n"; + foreach ($aResult['sNameDetails'] as $sKey => $sValue) { + echo ''; + echo htmlspecialchars($sValue); + echo ''; + } + echo ''; + } + + if (isset($aResult['address'])) { + if (!$bHasDelim) { + $bHasDelim = true; + echo '>'; + } + echo "\n"; + foreach ($aResult['address']->getAddressNames() as $sKey => $sValue) { + $sKey = str_replace(' ', '_', $sKey); + echo "<$sKey>"; + echo htmlspecialchars($sValue); + echo ""; + } + } + + if ($bHasDelim) { + echo ''; + } else { + echo '/>'; + } +} + +echo '';