ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 __construct ($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.

Constructor & Destructor Documentation

◆ __construct()

XMLStruct::__construct (   $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  }

Member Function Documentation

◆ append()

XMLStruct::append (   $a_name,
  $a_attrs 
)

append node

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

References $GLOBALS.

34  {
35  $struct = new XMLStruct($a_name, $a_attrs);
36  $struct->parent =&$GLOBALS["lastObj"];
37 
38  $GLOBALS["lastObj"] =&$struct;
39  $this->childs[] =&$struct;
40  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Class for creating an object (new node) by parsing XML code and adding it to an existing DOM object...

◆ 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.

References $key.

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

◆ 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.

References $GLOBALS.

46  {
47  $GLOBALS["lastObj"] =&$GLOBALS["lastObj"]->parent;
48  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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: