I'm confused. You are setting XML, type regular string, as Proxy data? Why not set DOMDocument instance or SimpleXMLElement instance as Proxy data?
No, I am wanting to use the DOMDocument or SimpleXMLElement instance as the proxy data. My question was more related to how to implement either of them. For example, if I have this...
<?php
class FooBarProxy extends Proxy implements IProxy
{
public function loadXML($filename)
{
$xml = simplexml_load_file($filename);
$this->setData($xml);
}
public function getNodeValue($nodeName)
{
return $this->getData()->$nodeName;
}
public function setNodeValue($nodeName, $value)
{
$xml = $this->getData();
$xml->$nodeName = $value;
$this->setData($xml);
}
}
Whenever I call setNodeValue, I am basically creating a second copy of the xml data in order to update with the new value. In AS3, getData returns a reference to the actual data so in terms of PHP it would something like this...
public function setNodeValue($nodeName, $value)
{
$this->getData()->$nodeName = $value;
}
My overall question is..would my original setNodeValue function from the first code snippet be considered "correct"? Ie. make a local copy of the xml instance, manipulate it, then setData.
To me, making that second local copy just seems inefficient. I would think it would be better to use the proxy to somehow manipulate the data directly...not make copies, manipulate, then setData.