- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/lib/web/dom/node.php
- Класс: BitrixMainWebDOMNode
- Вызов: Node::toArray
public function toArray()
{
$childNodes = array();
if($this->hasChildNodes())
{
foreach($this->getChildNodesArray() as $child)
{
/* @var $child Node*/
$childNodes[] = $child->toArray();
}
}
$attributes = array();
if($this->hasAttributes())
{
foreach($this->getAttributes() as $attr)
{
/* @var $attr Attr*/
$attributes = array_merge($attributes, $attr->toArray());
}
}
return array(
'nodeType' => $this->nodeType,
'nodeName' => $this->nodeName,
'textContent' => $this->getTextContent(),
'attributesCount' => count($attributes),
'attributes' => $attributes,
'childNodesCount' => count($childNodes),
'childNodes' => $childNodes,
);
}