ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
XMLStruct Class Reference

Class for creating an object (new node) by parsing XML code and adding it to an existing DOM object. More...

+ Collaboration diagram for XMLStruct:

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

Detailed Description

Class for creating an object (new node) by parsing XML code and adding it to an existing DOM object.

Author
Jens Conze jconz.nosp@m.e@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilXML2DOM.php 20150 2009-06-08 18:02:33Z akill

Definition at line 13 of file class.ilXML2DOM.php.

Member Function Documentation

XMLStruct::append (   $a_name,
  $a_attrs 
)

append node

Definition at line 33 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

Parameters
object$domDOM object
object$nodeparent node

Definition at line 64 of file class.ilXML2DOM.php.

References $key.

{
$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 53 of file class.ilXML2DOM.php.

{
//echo "<br>XMLStruct:setContent-".$this->name."-$a_data-";
$this->content[] = $a_data;
}
XMLStruct::setParent ( )

set parent node

Definition at line 45 of file class.ilXML2DOM.php.

References $GLOBALS.

{
$GLOBALS["lastObj"] =& $GLOBALS["lastObj"]->parent;
}
XMLStruct::XMLStruct (   $a_name = "",
  $a_attrs = array() 
)

constructor

Definition at line 24 of file class.ilXML2DOM.php.

Referenced by append().

{
$this->name = $a_name;
$this->attrs = $a_attrs;
}

+ Here is the caller graph for this function:

Field Documentation

XMLStruct::$attrs

Definition at line 19 of file class.ilXML2DOM.php.

XMLStruct::$childs = array()

Definition at line 15 of file class.ilXML2DOM.php.

XMLStruct::$content = array()

Definition at line 18 of file class.ilXML2DOM.php.

XMLStruct::$name

Definition at line 17 of file class.ilXML2DOM.php.

XMLStruct::$parent

Definition at line 16 of file class.ilXML2DOM.php.


The documentation for this class was generated from the following file: