ILIAS  Release_3_10_x_branch Revision 61812
 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 7047 2005-03-24 21:25:43Z akill

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

Member Function Documentation

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

Parameters
object$domDOM object
object$nodeparent node

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

{
$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 ( )

set parent node

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

References $GLOBALS.

{
$GLOBALS["lastObj"] =& $GLOBALS["lastObj"]->parent;
}
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:

Field Documentation

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.


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