예제 #1
0
 /**
  * Parses the given XML document into an instance of SVGImage.
  *
  * @param \SimpleXMLElement $xml The root node of the SVG document to parse.
  *
  * @return SVGImage An image object representing the parse result.
  */
 public function parseXML(\SimpleXMLElement $xml)
 {
     $name = $xml->getName();
     if ($name !== 'svg') {
         return false;
     }
     $dim = $this->getDimensions($xml);
     $img = new SVGImage($dim[0], $dim[1]);
     $doc = $img->getDocument();
     $this->applyAttributes($doc, $xml);
     $this->applyStyles($doc, $xml);
     $this->addChildren($doc, $xml);
     return $img;
 }
예제 #2
0
 public function testToXMLString()
 {
     $image = SVGImage::fromString($this->xml);
     $this->assertSame($this->xml, $image->toXMLString());
 }