ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 More...
 
 append ($a_name, $a_attrs)
 append node More...
 
 setParent ()
 set parent node More...
 
 setContent ($a_data)
 set content text More...
 
 insert (&$dom, &$node)
 insert new node in existing DOM object More...
 

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$

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

Member Function Documentation

◆ append()

XMLStruct::append (   $a_name,
  $a_attrs 
)

append node

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

34 {
35 $struct = new XMLStruct($a_name, $a_attrs);
36 $struct->parent =& $GLOBALS["lastObj"];
37
38 $GLOBALS["lastObj"] =& $struct;
39 $this->childs[] =& $struct;
40 }
XMLStruct($a_name="", $a_attrs=array())
constructor
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, and XMLStruct().

+ Here is the call graph for this function:

◆ insert()

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.

65 {
66 $newNode = $dom->create_element($this->name);
67 if ($this->content != "")
68 {
69 $newNode->set_content(implode("", $this->content));
70 }
71 if (is_array($this->attrs))
72 {
73 #vd($this->attrs);
74 reset ($this->attrs);
75 while (list ($key, $val) = each ($this->attrs)) {
76 $newNode->set_attribute($key, $val);
77 }
78 }
79 $node = $node->append_child($newNode);
80 for ($j = 0; $j < count($this->childs); $j++)
81 {
82 $this->childs[$j]->insert($dom, $node);
83 }
84 $node = $node->parent_node();
85 }

◆ setContent()

XMLStruct::setContent (   $a_data)

set content text

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

54 {
55//echo "<br>XMLStruct:setContent-".$this->name."-$a_data-";
56 $this->content[] = $a_data;
57 }

◆ setParent()

XMLStruct::setParent ( )

set parent node

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

46 {
47 $GLOBALS["lastObj"] =& $GLOBALS["lastObj"]->parent;
48 }

References $GLOBALS.

◆ XMLStruct()

XMLStruct::XMLStruct (   $a_name = "",
  $a_attrs = array() 
)

constructor

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

25 {
26 $this->name = $a_name;
27 $this->attrs = $a_attrs;
28 }

Referenced by append().

+ Here is the caller graph for this function:

Field Documentation

◆ $attrs

XMLStruct::$attrs

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

◆ $childs

XMLStruct::$childs = array()

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

◆ $content

XMLStruct::$content = array()

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

◆ $name

XMLStruct::$name

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

◆ $parent

XMLStruct::$parent

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


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