NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP DOMXM LQuestion

Peter Sawczynec ps at pswebcode.com
Fri May 20 22:00:50 EDT 2005


For the life of me, I can't get the domxml set_content() method to work on a
node. 
I can do get_content() on the node. 
How does one update a single node? 

For example:
The following read process works:
$xml = join('',file('listings_list.xml'));
$dom = domxml_open_mem($xml);
$xpObj = xpath_new_context($dom);
$resObj = xpath_eval($xpObj, "//listing[@id=$id]");
$theOne = $resObj->nodeset[0];
$y1Element = $theOne->get_elements_by_tagname('images1');
$i1 = $y1Element[0]->get_content();
echo $i1

The self-same update does not:
$xml = join('',file('listings_list.xml'));
$dom = domxml_open_mem($xml);
$xpObj = xpath_new_context($dom);
$resObj = xpath_eval($xpObj, "//listing[@id=$id]");
$theOne = $resObj->nodeset[0];
$y1Element = $theOne->get_elements_by_tagname('images1');
$y1Element[0]->set_content();



Warmest regards,

Peter Sawczynec
Technology Director
PSWebcode
ps at pswebcode.com
718.543.3240





More information about the talk mailing list