ILIAS  release_4-4 Revision
ilExportFileParser Class Reference

Export file parser. More...

+ Inheritance diagram for ilExportFileParser:
+ Collaboration diagram for ilExportFileParser:

Public Member Functions

 __construct ($a_file, $a_callback_obj, $a_callback_func)
 Constructor. More...
 
 setHandlers ($a_xml_parser)
 Set event handlers. More...
 
 startParsing ()
 Start parser. More...
 
 handleBeginTag ($a_xml_parser, $a_name, $a_attribs)
 Begin Tag. More...
 
 handleEndTag ($a_xml_parser, $a_name)
 End Tag. More...
 
 handleCharacterData ($a_xml_parser, $a_data)
 End Tag. More...
 
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Protected Attributes

 $item_xml = ""
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Detailed Description

Export file parser.

Author
Aleex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilExportFileParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilExportFileParser::__construct (   $a_file,
  $a_callback_obj,
  $a_callback_func 
)

Constructor.

Parameters

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

References startParsing().

25  {
26  $this->callback_obj = $a_callback_obj;
27  $this->callback_func = $a_callback_func;
28 
29  parent::ilSaxParser($a_file, true);
30  $this->startParsing();
31  }
+ Here is the call graph for this function:

Member Function Documentation

◆ handleBeginTag()

ilExportFileParser::handleBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

Begin Tag.

Definition at line 57 of file class.ilExportFileParser.php.

58  {
59  if ($this->in_export_item)
60  {
61  $this->export_item_writer->xmlStartTag($a_name, $a_attribs);
62  }
63 
64  switch ($a_name)
65  {
66  case "exp:Export":
67  $this->entity = $a_attribs["Entity"];
68  $this->install_id = $a_attribs["InstallationId"];
69  $this->install_url = $a_attribs["InstallationUrl"];
70  $this->schema_version = $a_attribs["SchemaVersion"];
71  break;
72 
73  case "exp:ExportItem":
74  $this->in_export_item = true;
75  $this->current_id = $a_attribs["Id"];
76 
77  $this->export_item_writer = new ilXmlWriter();
78 
79  $this->item_xml = "";
80  $this->expfiles[] = array("component" => $a_attribs["Component"],
81  "path" => $a_attribs["Path"]);
82  break;
83  }
84  }
XML writer class.

◆ handleCharacterData()

ilExportFileParser::handleCharacterData (   $a_xml_parser,
  $a_data 
)

End Tag.

Definition at line 115 of file class.ilExportFileParser.php.

116  {
117  //$a_data = str_replace("<","&lt;",$a_data);
118  //$a_data = str_replace(">","&gt;",$a_data);
119  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
120  //$a_data = preg_replace("/\n/","",$a_data);
121  //$a_data = preg_replace("/\t+/","",$a_data);
122 
123  $this->chr_data .= $a_data;
124 
125  if ($this->in_export_item)
126  {
127  $this->export_item_writer->xmlData($a_data);
128  }
129  }

◆ handleEndTag()

ilExportFileParser::handleEndTag (   $a_xml_parser,
  $a_name 
)

End Tag.

Definition at line 89 of file class.ilExportFileParser.php.

90  {
91  switch ($a_name)
92  {
93  case "exp:ExportItem":
94  $this->in_export_item = false;
95  $cf = $this->callback_func;
96  $this->callback_obj->$cf($this->entity, $this->schema_version, $this->current_id,
97  $this->export_item_writer->xmlDumpMem(false), $this->install_id,
98  $this->install_url);
99  break;
100 
101  }
102 
103  if ($this->in_export_item)
104  {
105  $this->export_item_writer->xmlEndTag($a_name);
106  }
107 
108 
109  $this->chr_data = "";
110  }

◆ setHandlers()

ilExportFileParser::setHandlers (   $a_xml_parser)

Set event handlers.

Parameters
resourcereference to the xml parser private

Definition at line 39 of file class.ilExportFileParser.php.

40  {
41  xml_set_object($a_xml_parser,$this);
42  xml_set_element_handler($a_xml_parser, 'handleBeginTag', 'handleEndTag');
43  xml_set_character_data_handler($a_xml_parser, 'handleCharacterData');
44  }

◆ startParsing()

ilExportFileParser::startParsing ( )

Start parser.

Definition at line 49 of file class.ilExportFileParser.php.

Referenced by __construct().

50  {
51  parent::startParsing();
52  }
+ Here is the caller graph for this function:

Field Documentation

◆ $item_xml

ilExportFileParser::$item_xml = ""
protected

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


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