コード例 #1
0
 function startElement(&$parser, $tag, $attributes)
 {
     $this->currentData = null;
     switch ($tag) {
         case 'xs:simpleType':
             if ($attributes['name'] == $this->_listName) {
                 $this->_foundRequestedList = true;
             }
             break;
         case 'xs:enumeration':
             if ($this->_foundRequestedList) {
                 $this->_currentValue = $attributes['value'];
                 $this->_listItems[$this->_currentValue] = array();
                 // initialize the array cell
             }
             break;
         case 'xs:documentation':
             if ($this->_foundRequestedList) {
                 $this->_insideDocumentation = true;
             }
             break;
     }
     $node = new XMLNode($tag);
     $node->setAttributes($attributes);
     if (isset($this->currentNode)) {
         $this->currentNode->addChild($node);
         $node->setParent($this->currentNode);
     } else {
         $this->rootNode =& $node;
     }
     $this->currentNode =& $node;
 }
 /**
  * Callback function to act as the start element handler.
  */
 function startElement(&$parser, $tag, $attributes)
 {
     $this->currentData = null;
     $node = new XMLNode($tag);
     $node->setAttributes($attributes);
     if (isset($this->currentNode)) {
         $this->currentNode->addChild($node);
         $node->setParent($this->currentNode);
     } else {
         $this->rootNode =& $node;
     }
     $this->currentNode =& $node;
 }
コード例 #3
0
 public function getTileUrl()
 {
     REST::requireRequestMethod('GET');
     $requiredParameters = array('lat', 'lon', 'zoom');
     if (Util::isValid($requiredParameters, $values, $this->params)) {
         extract($values);
         $url = "http://tile.openstreetmap.org/" . Map::getTileNumber($lat, $lon, $zoom) . ".png";
         $urlNode = new XMLNode('url');
         $urlNode->setAttribute('href', $url);
         $mapNode = new XMLNode('map');
         $mapNode->setAttributes($values);
         $mapNode->addNode($urlNode);
         $xmlDoc = new XMLDocument();
         $xmlDoc->setRootNode($mapNode);
         REST::sendResponse(200, $xmlDoc, 'application/xml');
     } else {
         REST::sendResponse(400);
     }
 }
コード例 #4
0
ファイル: index.php プロジェクト: BGCX261/zonetrak-svn-to-git
<?php

require_once 'config.inc.php';
$router = new Router($_SERVER['REQUEST_URI']);
try {
    $router->connect();
} catch (Exception $e) {
    $errorNode = new XMLNode('error');
    $errorNode->setAttributes(array('code' => 400));
    $errorNode->setContent($e->getMessage());
    $xmlDoc = new XMLDocument();
    $xmlDoc->setRootNode($errorNode);
    echo strval($xmlDoc);
}