//原创,可以自由使用,欢迎提出改进意见,
<?PHP
//xml中的元素
class XMLTag
{
var $parent;//父节点
var $child;//子节点
var $attribute;//本节点属性
var $data;//本节点数据
var $TagName;//本节点名称
var $depth;//本节点的深度,根节点为1
function XMLTag($tag='')
{
$this->attribute = array();
$this->child = array();
$this->depth = 0;
$this->parent = null;
$this->data = '';
$this->TagName = $tag;
}
function SetTagName($tag)
{
$this->TagName = $tag;
}
function SetParent(&$parent)
{
$this->parent = &$parent;
}
function SetAttribute($name,$value)
{
$this->attribute[$name] = $value;
}
function AppendChild(&$child)
{
$i = count($this->child);
$this->child[$i] = &$child;
}
function SetData($data)
{
$this->data= $data;
}
function GetAttr()
{
return $this->attribute;
}
function GetProperty($name)
{
return $this->attribute[$name];
}
function GetData()
{
return $this->data;
}
function GetParent()
{
return $this->parent;
}
function GetChild()
{
return $this->child;
}
function GetChildByName($name)
{
$total = count($this->child);
for($i=0;$i<$total;$
| 对此文章发表了评论 |
