function cleanRIFCSofEmptyTags($rifcs, $removeFormAttributes = 'true', $throwExceptions = false) { try { $xslt_processor = Transforms::get_form_to_cleanrif_transformer(); $dom = new DOMDocument(); //$dom->loadXML($this->ro->getXML()); $dom->loadXML(str_replace('&', '&', $rifcs), LIBXML_NOENT); //$dom->loadXML($rifcs); $xslt_processor->setParameter('', 'removeFormAttributes', $removeFormAttributes); return $xslt_processor->transformToXML($dom); } catch (Exception $e) { if ($throwExceptions) { throw new Exception("UNABLE TO TRANSFORM" . nl2br($e->getMessage())); } else { echo "UNABLE TO TRANSFORM" . BR; echo "<pre>" . nl2br($e->getMessage()) . "</pre>" . BR; } } }
function cleanRIFCSofEmptyTags($rifcs, $removeFormAttributes = 'true') { if (strlen($rifcs) > 50000) { $rifcs = preg_replace('/<relatedObject.*?<\\/relatedObject>|\\s{2,}/ms', '', $rifcs); } $xslt_processor = Transforms::get_form_to_cleanrif_transformer(); $dom = new DOMDocument(); //$dom->loadXML($this->ro->getXML()); $dom->loadXML(wrapRegistryObjects(unWrapRegistryObjects($rifcs))); //$dom->loadXML($rifcs); $xslt_processor->setParameter('', 'removeFormAttributes', $removeFormAttributes); return $xslt_processor->transformToXML($dom); }