예제 #1
0
 public function getMetricsFromSvg($svg, &$output)
 {
     $output = $output;
     $svgXml = com_wiris_util_xml_WXmlUtils::parseXML($svg);
     $width = $svgXml->firstElement()->get("width");
     $height = $svgXml->firstElement()->get("height");
     $baseline = $svgXml->firstElement()->get("wrs:baseline");
     $r = null;
     if ($output !== null) {
         $output["width"] = "" . $width;
         $output["height"] = "" . $height;
         $output["baseline"] = "" . $baseline;
         $r = "";
     } else {
         $r = "&cw=" . $width . "&ch=" . $height . "&cb=" . $baseline;
     }
     return $r;
 }
예제 #2
0
 static function importXml($elem, $model)
 {
     $n = null;
     if ($elem->nodeType == Xml::$Element) {
         $n = Xml::createElement($elem->getNodeName());
         $keys = $elem->attributes();
         while ($keys->hasNext()) {
             $key = $keys->next();
             $n->set($key, $elem->get($key));
             unset($key);
         }
         $children = $elem->iterator();
         while ($children->hasNext()) {
             $n->addChild(com_wiris_util_xml_WXmlUtils::importXml($children->next(), $model));
         }
     } else {
         if ($elem->nodeType == Xml::$Document) {
             $n = com_wiris_util_xml_WXmlUtils::importXml($elem->firstElement(), $model);
         } else {
             if ($elem->nodeType == Xml::$CData) {
                 $n = Xml::createCData($elem->getNodeValue());
             } else {
                 if ($elem->nodeType == Xml::$PCData) {
                     $n = Xml::createPCData($elem->getNodeValue());
                 } else {
                     throw new HException("Unsupported node type: " . Std::string($elem->nodeType));
                 }
             }
         }
     }
     return $n;
 }