Created
October 18, 2012 14:42
-
-
Save harmstyler/3912306 to your computer and use it in GitHub Desktop.
Handle xml fields in eZ Publish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function handleXmlField($bodyXml, $parser="simple") | |
{ | |
$parser = new eZSimplifiedXMLInputParser(null); | |
if ($parser == 'oe') { | |
$parser = new eZOEInputParser(null); | |
} | |
$parser->setParseLineBreaks(false); | |
$document = $parser->process($bodyXml); | |
if (!is_object($document)) { | |
$document = $parser->createRootNode(); | |
} | |
$result = eZXMLTextType::domString($document); | |
$result = str_replace('<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"/>', '', $result); | |
return $result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment