Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Handle xml fields in eZ Publish
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