ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
_parse_proppatch Class Reference
+ Collaboration diagram for _parse_proppatch:

Public Member Functions

 _parse_proppatch ($path)
 constructor
 _startElement ($parser, $name, $attrs)
 tag start handler
 _endElement ($parser, $name)
 tag end handler
 _data ($parser, $data)
 input data handler

Data Fields

 $success
 $props
 $depth
 $mode
 $current

Detailed Description

Definition at line 30 of file _parse_proppatch.php.

Member Function Documentation

_parse_proppatch::_data (   $parser,
  $data 
)

input data handler

Parameters
resourceparser
stringdata
Returns
void private

Definition at line 207 of file _parse_proppatch.php.

References $data.

{
if (isset($this->current)) {
$this->current["val"] .= $data;
}
}
_parse_proppatch::_endElement (   $parser,
  $name 
)

tag end handler

Parameters
resourceparser
stringtag name
Returns
void private

Definition at line 174 of file _parse_proppatch.php.

References $current, and $name.

{
if (strstr($name, " ")) {
list($ns, $tag) = explode(" ", $name);
if ($ns == "")
$this->success = false;
} else {
$ns = "";
$tag = $name;
}
$this->depth--;
if ($this->depth >= 4) {
$this->current["val"] .= "</$tag>";
}
if ($this->depth == 3) {
if (isset($this->current)) {
$this->props[] = $this->current;
unset($this->current);
}
}
}
_parse_proppatch::_parse_proppatch (   $path)

constructor

Parameters
stringpath of input stream public

Definition at line 78 of file _parse_proppatch.php.

{
$this->success = true;
$this->depth = 0;
$this->props = array();
$had_input = false;
$f_in = fopen($path, "r");
if (!$f_in) {
$this->success = false;
return;
}
$xml_parser = xml_parser_create_ns("UTF-8", " ");
xml_set_element_handler($xml_parser,
array(&$this, "_startElement"),
array(&$this, "_endElement"));
xml_set_character_data_handler($xml_parser,
array(&$this, "_data"));
xml_parser_set_option($xml_parser,
XML_OPTION_CASE_FOLDING, false);
while($this->success && !feof($f_in)) {
$line = fgets($f_in);
if (is_string($line)) {
$had_input = true;
$this->success &= xml_parse($xml_parser, $line, false);
}
}
if($had_input) {
$this->success &= xml_parse($xml_parser, "", true);
}
xml_parser_free($xml_parser);
fclose($f_in);
}
_parse_proppatch::_startElement (   $parser,
  $name,
  $attrs 
)

tag start handler

Parameters
resourceparser
stringtag name
arraytag attributes
Returns
void private

Definition at line 130 of file _parse_proppatch.php.

References $key, and $name.

{
if (strstr($name, " ")) {
list($ns, $tag) = explode(" ", $name);
if ($ns == "")
$this->success = false;
} else {
$ns = "";
$tag = $name;
}
if ($this->depth == 1) {
$this->mode = $tag;
}
if ($this->depth == 3) {
$prop = array("name" => $tag);
$this->current = array("name" => $tag, "ns" => $ns, "status"=> 200);
if ($this->mode == "set") {
$this->current["val"] = ""; // default set val
}
}
if ($this->depth >= 4) {
$this->current["val"] .= "<$tag";
foreach ($attr as $key => $val) {
$this->current["val"] .= ' '.$key.'="'.str_replace('"','&quot;', $val).'"';
}
$this->current["val"] .= ">";
}
$this->depth++;
}

Field Documentation

_parse_proppatch::$current

Definition at line 70 of file _parse_proppatch.php.

Referenced by _endElement().

_parse_proppatch::$depth

Definition at line 54 of file _parse_proppatch.php.

_parse_proppatch::$mode

Definition at line 62 of file _parse_proppatch.php.

_parse_proppatch::$props

Definition at line 46 of file _parse_proppatch.php.

_parse_proppatch::$success

Definition at line 38 of file _parse_proppatch.php.


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