Exemplo n.º 1
0
 /**
  * Gets a request object from the provided request XML
  * @param string $xml The XML of a XML-RPC request
  * @return Request
  */
 public static function fromXMLString($xml)
 {
     $xml = trim($xml);
     if (empty($xml)) {
         throw new XmlRpcException('Empty request recieved', 1);
     }
     $dom = new Document('1.0', 'utf-8');
     $dom->preserveWhiteSpace = false;
     $dom->setRelaxNGFileFromConfig(self::CONFIG_REQUEST_RNG);
     try {
         $dom->loadXML($xml);
     } catch (Exception $exception) {
         throw new XmlRpcException($xml, 0, $exception);
     }
     $element = $dom->documentElement;
     return new self($element);
 }
Exemplo n.º 2
0
 public function testLoadXMLWithValidXML()
 {
     $doc = new Document('1.0', 'utf-8');
     $doc->loadXML('<?xml version="1.0" encoding="UTF-8"?><root><valid/></root>');
 }