Class for creating an object (new node) by parsing XML code and adding it to an existing DOM object. More...
Public Member Functions | |
| XMLStruct ($a_name="", $a_attrs=array()) | |
| constructor | |
| append ($a_name, $a_attrs) | |
| append node | |
| setParent () | |
| set parent node | |
| setContent ($a_data) | |
| set content text | |
| insert (&$dom, &$node) | |
| insert new node in existing DOM object | |
Data Fields | |
| $childs = array() | |
| $parent | |
| $name | |
| $content = array() | |
| $attrs | |
Class for creating an object (new node) by parsing XML code and adding it to an existing DOM object.
Definition at line 33 of file class.ilXML2DOM.php.
| XMLStruct::append | ( | $ | a_name, | |
| $ | a_attrs | |||
| ) |
append node
Definition at line 53 of file class.ilXML2DOM.php.
References $GLOBALS, and XMLStruct().
{
$struct = new XMLStruct($a_name, $a_attrs);
$struct->parent =& $GLOBALS["lastObj"];
$GLOBALS["lastObj"] =& $struct;
$this->childs[] =& $struct;
}
Here is the call graph for this function:| XMLStruct::insert | ( | &$ | dom, | |
| &$ | node | |||
| ) |
insert new node in existing DOM object
| object | $dom DOM object | |
| object | $node parent node |
Definition at line 84 of file class.ilXML2DOM.php.
References $dom.
{
$newNode = $dom->create_element($this->name);
if ($this->content != "")
{
$newNode->set_content(implode("", $this->content));
}
if (is_array($this->attrs))
{
#vd($this->attrs);
reset ($this->attrs);
while (list ($key, $val) = each ($this->attrs)) {
$newNode->set_attribute($key, $val);
}
}
$node = $node->append_child($newNode);
for ($j = 0; $j < count($this->childs); $j++)
{
$this->childs[$j]->insert($dom, $node);
}
$node = $node->parent_node();
}
| XMLStruct::setContent | ( | $ | a_data | ) |
set content text
Definition at line 73 of file class.ilXML2DOM.php.
{
//echo "<br>XMLStruct:setContent-".$this->name."-$a_data-";
$this->content[] = $a_data;
}
| XMLStruct::setParent | ( | ) |
| XMLStruct::XMLStruct | ( | $ | a_name = "", |
|
| $ | a_attrs = array() | |||
| ) |
constructor
Definition at line 44 of file class.ilXML2DOM.php.
Referenced by append().
{
$this->name = $a_name;
$this->attrs = $a_attrs;
}
Here is the caller graph for this function:| XMLStruct::$attrs |
Definition at line 39 of file class.ilXML2DOM.php.
| XMLStruct::$childs = array() |
Definition at line 35 of file class.ilXML2DOM.php.
| XMLStruct::$content = array() |
Definition at line 38 of file class.ilXML2DOM.php.
| XMLStruct::$name |
Definition at line 37 of file class.ilXML2DOM.php.
| XMLStruct::$parent |
Definition at line 36 of file class.ilXML2DOM.php.
1.7.1