Example #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;
 }
 static function __character_data_handler($parser, $data)
 {
     if (strlen($data) === 1 && htmlentities($data) != $data || htmlentities($data) == $data) {
         Xml::$build->addChild(Xml::createPCData(htmlentities($data)));
     } else {
         Xml::$build->addChild(Xml::createCData($data));
     }
 }
Example #3
0
 static function __character_data_handler($parser, $data)
 {
     $d = Xml::__decodeent($data);
     if (strlen($data) === 1 && $d !== $data || $d === $data) {
         $last = Xml::$build->_children[Xml::$build->_children->length - 1];
         if (null !== $last && (is_object($_t = $last->nodeType) && !$_t instanceof Enum ? $_t === Xml::$PCData : $_t == Xml::$PCData)) {
             $_g = $last;
             $_g->set_nodeValue(_hx_string_or_null($_g->get_nodeValue()) . _hx_string_or_null($d));
         } else {
             Xml::$build->addChild(Xml::createPCData($d));
         }
     } else {
         Xml::$build->addChild(Xml::createCData($data));
     }
 }
Example #4
0
 static function __character_data_handler($parser, $data)
 {
     $d = Xml::__decodeent($data);
     if (strlen($data) === 1 && $d !== $data || $d === $data) {
         $last = Xml::$build->_children[Xml::$build->_children->length - 1];
         if (null !== $last && $last->nodeType == Xml::$PCData) {
             $_g = $last;
             $_g->setNodeValue($_g->getNodeValue() . $d);
         } else {
             Xml::$build->addChild(Xml::createPCData($d));
         }
     } else {
         Xml::$build->addChild(Xml::createCData($data));
     }
 }
Example #5
0
 static function __character_data_handler($parser, $data)
 {
     $lc = Xml::$build->_children === null || Xml::$build->_children->length === 0 ? null : Xml::$build->_children[Xml::$build->_children->length - 1];
     if ($lc !== null && Xml::$PCData == $lc->nodeType) {
         $lc->setNodeValue($lc->getNodeValue() . htmlentities($data));
     } else {
         if (strlen($data) === 1 && htmlentities($data) != $data || htmlentities($data) == $data) {
             Xml::$build->addChild(Xml::createPCData(htmlentities($data)));
         } else {
             Xml::$build->addChild(Xml::createCData($data));
         }
     }
 }