Forum OpenACS Q&A: Re: Deleting XML nodes using ns_xml

Collapse
Posted by Steffen Tiedemann Christensen on
I fixed up a temporary solution. It's not pretty but it gets the job done:

set node_name [ns_xml node name $node_id]
ns_xml node setattr $node_id "delete_this_node_now" "true"

set xml_data [ns_xml doc render $mod(doc_id)]

regsub -all -- "<\/${node_name}>" $xml_data \x81 xml_data
regsub -all -- "<${node_name}\[^>\]+delete_this_node_now=\"true\"\[^>\]*>\[^\x81\]*\x81" $xml_data "" xml_data
regsub -all -- "\x81" $xml_data "" xml_data