ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
XML2DOM Class Reference
+ Collaboration diagram for XML2DOM:

Public Member Functions

 XML2DOM ($a_xml)
 clean (&$attr)
 startElement ($a_parser, $a_name, $a_attrs)
 endElement ($a_parser, $a_name)
 characterData ($a_parser, $a_data)
 insertNode (&$dom, &$node)

Detailed Description

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

Member Function Documentation

XML2DOM::characterData (   $a_parser,
  $a_data 
)

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

References $GLOBALS.

{
$a_data = preg_replace("/&/","&",$a_data);
$GLOBALS["lastObj"]->setContent($a_data);
}
XML2DOM::clean ( $attr)

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

Referenced by startElement().

{
if(is_array($attr))
{
foreach($attr as $key => $value)
{
$attr[$key] = preg_replace("/&(?!amp;|lt;|gt;|quot;)/","&",$attr[$key]);
$attr[$key] = preg_replace("/\"/",""",$attr[$key]);
$attr[$key] = preg_replace("/</","&lt;",$attr[$key]);
$attr[$key] = preg_replace("/>/","&gt;",$attr[$key]);
}
}
return $attr;
}

+ Here is the caller graph for this function:

XML2DOM::endElement (   $a_parser,
  $a_name 
)

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

References $GLOBALS.

{
$GLOBALS["lastObj"]->setParent();
}
XML2DOM::insertNode ( $dom,
$node 
)

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

{
$node = $this->xmlStruct->insert($dom, $node);
}
XML2DOM::startElement (   $a_parser,
  $a_name,
  $a_attrs 
)

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

References $GLOBALS, and clean().

{
if (!is_object($this->xmlStruct))
{
#vd($a_attrs);
$this->xmlStruct = new XMLStruct($a_name, $a_attrs);
$GLOBALS["lastObj"] =& $this->xmlStruct;
}
else
{
$a_attrs = $this->clean($a_attrs);
#var_dump("<pre>",++$counter," ",$a_name," -> ",$a_attrs,"<pre>");
$GLOBALS["lastObj"]->append($a_name, $a_attrs);
}
}

+ Here is the call graph for this function:

XML2DOM::XML2DOM (   $a_xml)

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

{
$xml_parser = xml_parser_create("UTF-8");
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
xml_set_object($xml_parser, $this);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!xml_parse($xml_parser, $a_xml, true))
{
die(sprintf("XML error: %s at line %d",
xml_error_string(xml_get_error_code($xml_parser)),
xml_get_current_line_number($xml_parser)));
}
xml_parser_free($xml_parser);
}

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