Okay, I'm a bit stumped. I'm more familiar with Python when manipulating XML, but I would like to use PHP in this instance if possible.
Is there a relatively straightforward way to replace a chunk of text - all the children and values for a given node - in an XML file with another set of elements?
Starting with this:
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:fedora="info:fedora/fedora-system:def/relations-external#" xmlns:myns="http://www.nsdl.org/ontologies/relationships#">
<rdf:Description rdf:about="info:fedora/cfai:EB01a004">
<fedora:isMemberOfCollection rdf:resource="info:fedora/cfai:collection"/>
</rdf:Description>
</rdf:RDF>
And I would like it to looks like this:
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:fedora="info:fedora/fedora-system:def/relations-external#" xmlns:myns="http://www.nsdl.org/ontologies/relationships#">
<rdf:Description rdf:about="info:fedora/cfai:EB01a004">
<element>These are new elements that I paste in.</element>
<element>This is another, basically just a string of elements</element>
</rdf:Description>
</rdf:RDF>
I've got it loaded with simple_xml_loadfile, I've got the namespaces cooking with registerXPathNamespace, but I'm having an embarassingly hard time figuring out how to 1) remove nodes, and 2) insert my own chunk of text in their place.
Any help would be greatly appreciated.