I have a XML feed of products that I break down into smaller XML files using DOMDocument and DOMXpath in PHP.
I create the new XML file, add a root node then import all the deep-copied nodes from the main feed. I want to remove the namespace from the imported node.
I have tried $node->removeAttributeNS( 'myurl' , '' ) which correctly removes the xmlns attribute from the node but creates a default namespace so the output looks like
<default:node />
would like to remove any trace of namespaces associated with the imported node ready for registering new namespaces.
Any tips gratefully received.
I’m not sure if this is actually what you are looking for but have you thought about using
xml_parser_create()or `xml_parser_create_ns() to create a parser and then set your own processing functions to remove the namespaces.There are more functions that can be used to handle the xml found at php.net