示例#1
0
文件: RssDas.php 项目: psagi/sdo
 /**
  * To XML
  *
  * @param SDO $sdo SDO
  *
  * @return string
  */
 public static function toXml($sdo)
 {
     $type = $sdo->getTypeName();
     $xmldas = self::getXmlDas();
     $xdoc = $xmldas->createDocument('', $type, $sdo);
     $xmlstr = $xmldas->saveString($xdoc);
     return $xmlstr;
 }
示例#2
0
文件: Proxy.php 项目: psagi/sdo
 /**
  * NOTE: there is a problem with this process - it generates the elements
  * as attributes with values rather than elements, so when they are unpacked on the other side and converted back to an sdo, the values are lost and only the 'attributes' are part of the sdo.
  *
  * @param SDO   $sdo SDO
  * @param mixed $xsd XSD
  *
  * @return mixed
  */
 protected function toXml($sdo, $xsd = null)
 {
     SCA::$logger->log("Entering");
     try {
         $type = $sdo->getTypeName();
         $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/Atom1.0.xsd');
         /*
         //Because the atom format is extensible, if the sdo contains an extended version of the entry type, then we will need to add the types belonging to the sdo we've just received. Code here for this is commented out for now, and the assumed solution is that the client would provide the xsd for the extended entry, so that we can add the types from it to the Atom model.
         //Without an xsd supplied, if you try to create an xml doc from an sdo which has properties that arent in the das, SDO will try to handle what it receives by making the properties in the sdo attributes in the xml doc (rather than elements) but it should probably be throwing an error instead. Working on testcases to explore this behaviour further and raise a defect around this.
         //so the question is how do we get the types for the sdo? Going to have to ask for the location of an xsd to be passed in with the sdo, at least for first version of this code.
         //TODO need to make sure we are finding the xsd however they express the path information.
         //$xmldas->addTypes($xsd);
         */
         $xdoc = $xmldas->createDocument('', $type, $sdo);
         $xmlstr = $xmldas->saveString($xdoc);
         return $xmlstr;
     } catch (Exception $e) {
         return $e->getMessage();
     }
 }
示例#3
0
 /**
  * To XML
  *
  * @param SDO $sdo SDO
  *
  * @return mixed
  */
 protected function toXml($sdo)
 {
     try {
         //get the type of the sdo eg. 'Contact', to avoid using 'BOGUS'
         $type = $sdo->getTypeName();
         SCA::$logger->log("type is {$type}");
         $xmldas = SDO_DAS_XML::create(dirname(__FILE__) . '/Atom1.0.xsd');
         $xdoc = $xmldas->createDocument('', $type, $sdo);
         $xmlstr = $xmldas->saveString($xdoc);
         return $xmlstr;
     } catch (Exception $e) {
         SCA::$logger->log("Found exception in AtomServer: " . $e->getMessage() . "\n");
         return $e->getMessage();
     }
 }
示例#4
0
文件: Server.php 项目: psagi/sdo
 /**
  * To XML
  *
  * @param SDO $sdo SDO
  *
  * @return mixed
  */
 protected function toXml($sdo)
 {
     try {
         $type = $sdo->getTypeName();
         $xdoc = $this->xml_das->createDocument('', $type, $sdo);
         $xmlstr = $this->xml_das->saveString($xdoc);
         return $xmlstr;
     } catch (Exception $e) {
         SCA::$logger->log("Found exception in SCA_Bindings_restrpc_Server " . "converting sdo to xml" . $e->getMessage() . "\n");
         return $e->getMessage();
     }
 }