Beispiel #1
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;
 }