Doctrine\OXM\Marshaller\MarshallerException::couldNotReadXml PHP Method

couldNotReadXml() public static method

public static couldNotReadXml ( $xml )
    public static function couldNotReadXml($xml)
    {
        return new self("The XMLReader could not read XML '{$xml}'");
    }

Usage Example

Beispiel #1
0
 /**
  * @param string $xml
  * @return object
  */
 function unmarshalFromString($xml)
 {
     $xml = trim((string) $xml);
     $reader = new XMLReader();
     if (!$reader->XML($xml)) {
         throw MarshallerException::couldNotReadXml($xml);
     }
     // Position at first detected element
     while ($reader->read() && $reader->nodeType !== XMLReader::ELEMENT) {
     }
     $mappedObject = $this->doUnmarshal($reader);
     $reader->close();
     return $mappedObject;
 }