public function setValue($name, $value)
{
$this->values[$name] = $value;
}
public function getValue($name=null)
{
return $name==null?
$this->values: $this->values[$name];
}
public function removeValue($name)
{
unset($this->values["$name"]);
}
public function setAttributes($attributes){
$this->attributes = $attributes;
}
public function setAttribute($name, $value)
{
$this->attributes[$name] = $value;
}
public function getAttribute($name=null)
{
return $name==null? $this->attributes:
$this->attributes[$name];
}
public function removeAttribute($name)
{
unset($this->attributes["$name"]);
}
public function getNodesSize()
{
return sizeof($this->nodes);
}
protected function setNode($name, $nodeId)
{
$this->nodes[$name]
= $nodeId;
}
public abstract function createNode($name, $attributes);
public abstract function removeNode($name);
public abstract function getNode($name=null);
protected function getNodeId($name=null)
{
return $name==null? $this->nodes: $this->nodes[$name];
}
protected function createNodeByName($rootNodeObj, $name, $attributes, $pId)
{
$tmpObject = $rootNodeObj->createNodeObject($pId, $name, $attributes);
$key = isset($attributes[id])?
$name.'_'.$attributes[id]: $name.'_'.$this->getNodesSize();
$this->setNode($key, $tmpObject->getSeq());
return $tmpObject;
}
protected function removeNodeByName($rootNodeObj, $name)
{
$rootNodeObj->removeNodeById($this->getNodeId($name));
if(sizeof($this->nodes)==1)
$this->nodes = array();
else
unset($this->nodes[$name]);
}
protected function getNodeByName($rootNodeObj, $name=null)
{
if($name==null)
{
$tmpList = array();
$tmpIds = $this->getNodeId();
foreach($tmpIds as $key=>$id)
$tmpList[$key] = $rootNodeObj->getNodeById($id);
return $tmpList;
}
else
{
$id = $this->getNodeId($name);
if($id===null)
{
$tmpIds = $this->getNodeId();