Ok, another question:
I have figured out how to add children to the node containing a specific attribute. However, how would I then add an attribute to a child within that node.
For example, I select a node with a specific attribute as such:
Code:
$snData = $xml->xpath('/shell/chapter/screen[@id=' . $snID . ']');
$snData[0]->addChild('background', $bground);
This works fine. However, I need to then add an attribute to a child within that. I thought I could used something like this:
Code:
$snData = $xml->xpath('/shell/chapter/screen[@id=' . $snID . ']/background');
$snData[0]->addAttribute('type', 'video');
But it does not work and I get error messages. Any suggestions?
Last edited by pdpullmn612; 06-11-2010 at 09:47 AM..
|