ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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.

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

References $GLOBALS.

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

References $key.

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

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: