| 包 | helper |
|---|---|
| 类层次 | QDom_Element » DOMElement » DOMNode |
| 实现的接口 | |
| 版本 | $Id: dom_element.php 2639 2009-07-31 07:38:22Z yangyi $ |
QDom_Element 类对PHP5自带的DOMElement进行了自己的扩展
| 方法 | 描述 | 定义于 |
|---|---|---|
| _match() | 根据给定的nodeName和attribute数组,对节点进行比较 | QDom_Element |
| prev() | 在同级之前的节点中查找 | QDom_Element |
public mixed __get($key)
| $key | string | |
| {return} | mixed |
魔法方法,获取attribute
public void __set($key, $val)
| $key | string | |
| $val | string | |
| {return} |
魔法方法,设置attribute
public void __isset($key)
| $key | string | |
| {return} |
魔法方法,检查attribute是否存在
public void __unset($key)
| $key | string | |
| {return} |
魔法方法,删除attribute
public void offsetExists($key)
| $key | mixed | |
| {return} | void |
实现ArrayAccess接口
public void offsetSet($key, $value)
| $key | mixed | |
| $value | mixed | |
| {return} | void |
实现ArrayAccess接口
public void offsetGet($key)
| $key | mixed | |
| {return} | void |
实现ArrayAccess接口
public void offsetUnset($key)
| $key | mixed | |
| {return} | void |
实现ArrayAccess接口
public string __toString()
返回当前element的xml字符串,相当于javascript dom里的outerHTML()
public void setAttributes($attrs)
| $attrs | array | |
| {return} |
批量设置attribute
public array getAttributes($key)
| $key | string | |
| {return} | array |
批量获取attribute,如果指定了key则只返回指定的
public void select($query, $return_first)
| $query | string | |
| $return_first | boolean | |
| {return} |
xpath查询
public DOMNode insertAfter($newnode, $refnode)
| $newnode | DOMNode | |
| $refnode | DOMNode | |
| {return} | DOMNode |
插入一个新的子节点到指定的子节点之后,返回插入的新子节点
public DOMNode inject($refnode, $where)
| $refnode | DOMNode | |
| $where | string | |
| {return} | DOMNode |
把节点插入到指定节点的指定位置
public boolean isFirst()
是否是第一个子节点
public boolean isLast()
是否最后一个子节点
public DOMNode clean()
清除所有的子节点
public void erase()
删除自己
public DOMElement appendXML($xml)
| $xml | string | |
| {return} | DOMElement |
把xml字符串插入到当前节点尾部
public DOMElement replaceXML($xml)
| $xml | string | |
| {return} | DOMElement |
用xml字符串替换当前节点的所有子节点
protected boolean _match($node, $nodeName, $attributes)
| $node | DOMElement | |
| $nodeName | string | |
| $attributes | array | |
| {return} | boolean |
根据给定的nodeName和attribute数组,对节点进行比较
public mixed prev($nodeName, $attributes)
| $nodeName | string | |
| $attributes | array | |
| {return} | mixed |
在同级之前的节点中查找 可以指定nodeName和attributes匹配条件
public mixed next($nodeName, $attributes)
| $nodeName | string | |
| $attributes | array | |
| {return} | mixed |
在同级之后的节点中查找 可以指定nodeName和attributes匹配条件