Transformers - ThomasWeinert/FluentDOM GitHub Wiki
Transformers
(FluentDOM >= 5.1)
Transformers take a DOM document and transform it into a new one.
Namespaces\Optimize
This optimizes the xmlns/xmlns:* attributes in an document. It puts the prefix definition up into the farthest ancestor node possible.
You can provide a namespace to prefix mapping. The prefixes of all matching element/attributes are changed.
$transformer = new FluentDOM\Transformer\Namespaces\Optimize(
$document,
[
'http://www.w3.org/2005/Atom' => 'feed',
'http://www.w3.org/1999/xhtml' => ''
]
);
$target = $transformer->getDocument();
$target->formatOutput = TRUE;
echo $target->saveXML();