ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDataSetImportParser Class Reference

Manifest parser for ILIAS standard export files. More...

+ Inheritance diagram for ilDataSetImportParser:
+ Collaboration diagram for ilDataSetImportParser:

Public Member Functions

 __construct ($a_top_entity, $a_schema_version, $a_xml, $a_ds, $a_mapping)
 Constructor.
 setHandlers ($a_xml_parser)
 Set event handlers.
 startParsing ()
 Start parser.
 handleBeginTag ($a_xml_parser, $a_name, $a_attribs)
 Begin Tag.
 handleEndTag ($a_xml_parser, $a_name)
 End Tag.
 handleCharacterData ($a_xml_parser, $a_data)
 End Tag.
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file= '', $throwException=false)
 Constructor setup ILIAS global object public.
 setXMLContent ($a_xml_content)
 getXMLContent ()
 getInputType ()
 createParser ()
 create parser
 setOptions ($a_xml_parser)
 set parser options
 openXMLFile ()
 open xml file
 parse ($a_xml_parser, $a_fp=null)
 parse xml file
 freeParser ($a_xml_parser)
 free xml parser handle
 setThrowException ($throwException)
 set error handling
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor.
 _PEAR ()
 Destructor (the emulated type of...).
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.
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes.
 isError ($data, $code=null)
 Tell whether a value is a PEAR error.
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled.
 expectError ($code= '*')
 This method is used to tell which errors you expect to get.
 popExpect ()
 This method pops one element off the expected error codes stack.
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available.
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack.
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.
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options.
 staticPushErrorHandling ($mode, $options=null)
 staticPopErrorHandling ()
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack.
 popErrorHandling ()
 Pop the last error handler used.
 loadExtension ($ext)
 OS independant PHP extension load.

Protected Attributes

 $import = null
 $entities = array()
 $current_entity = ""
 $current_version = ""
 $current_ftypes = array()
 $entities_sent = false
 $in_record = false
 $current_field = ""
 $current_field_values = array()

Additional Inherited Members

- Data Fields inherited from ilSaxParser
 $input_type = null
 $xml_content = ''
 $ilias
 $lng
 $xml_file
 $throwException = false
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle

Detailed Description

Manifest parser for ILIAS standard export files.

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

Definition at line 13 of file class.ilDataSetImportParser.php.

Constructor & Destructor Documentation

ilDataSetImportParser::__construct (   $a_top_entity,
  $a_schema_version,
  $a_xml,
  $a_ds,
  $a_mapping 
)

Constructor.

Parameters
@return

Definition at line 32 of file class.ilDataSetImportParser.php.

References ilSaxParser\ilSaxParser(), ilSaxParser\setXMLContent(), and startParsing().

{
$this->ds = $a_ds;
$this->mapping = $a_mapping;
$this->top_entity = $a_top_entity;
$this->schema_version = $a_schema_version;
$this->dspref = ($this->ds->getDSPrefix() != "")
? $this->ds->getDSPrefix().":"
: "";
$this->setXMLContent($a_xml);
$this->startParsing();
}

+ Here is the call graph for this function:

Member Function Documentation

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

Begin Tag.

Definition at line 74 of file class.ilDataSetImportParser.php.

{
switch ($a_name)
{
case $this->dspref."Dataset":
// $this->import->initDataset($this->ds_component, $a_attribs["top_entity"]);
break;
case $this->dspref."Types":
$this->current_entity = $a_attribs["Entity"];
$this->current_version = $a_attribs["Version"];
break;
case $this->dspref."FieldType":
$this->current_ftypes[$a_attribs["Name"]] =
$a_attribs["Type"];
break;
case $this->dspref."Rec":
$this->current_entity = $a_attribs["Entity"];
$this->in_record = true;
$this->current_field_values = array();
break;
default:
if ($this->in_record)
{
$field = explode(":", $a_name); // remove namespace
$field = $field[count($field) - 1];
$this->current_field = $field;
}
}
}
ilDataSetImportParser::handleCharacterData (   $a_xml_parser,
  $a_data 
)

End Tag.

Definition at line 153 of file class.ilDataSetImportParser.php.

{
//$a_data = str_replace("<","&lt;",$a_data);
//$a_data = str_replace(">","&gt;",$a_data);
// DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
//$a_data = preg_replace("/\n/","",$a_data);
//$a_data = preg_replace("/\t+/","",$a_data);
$this->chr_data .= $a_data;
}
ilDataSetImportParser::handleEndTag (   $a_xml_parser,
  $a_name 
)

End Tag.

Definition at line 111 of file class.ilDataSetImportParser.php.

References $current_entity, and $current_field.

{
switch ($a_name)
{
case $this->dspref."Types":
$this->entities[$this->current_entity] =
array(
"version" => $this->current_version,
"types" => $this->current_ftypes
);
$this->current_ftypes = array();
$this->current_entity = "";
$this->current_version = "";
break;
case $this->dspref."Rec":
$this->ds->importRecord($this->current_entity,
$this->entities[$this->current_entity]["types"],
$this->current_field_values,
$this->mapping,
$this->schema_version);
$this->in_record = false;
$this->current_entity = "";
$this->current_field_values = array();
break;
default:
if ($this->in_record && $this->current_field != "")
{
$this->current_field_values[$this->current_field] =
$this->chr_data;
}
$this->current_field = "";
break;
}
$this->chr_data = "";
}
ilDataSetImportParser::setHandlers (   $a_xml_parser)

Set event handlers.

Parameters
resourcereference to the xml parser private

Reimplemented from ilSaxParser.

Definition at line 55 of file class.ilDataSetImportParser.php.

{
xml_set_object($a_xml_parser,$this);
xml_set_element_handler($a_xml_parser, 'handleBeginTag', 'handleEndTag');
xml_set_character_data_handler($a_xml_parser, 'handleCharacterData');
}
ilDataSetImportParser::startParsing ( )

Start parser.

Reimplemented from ilSaxParser.

Definition at line 66 of file class.ilDataSetImportParser.php.

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

ilDataSetImportParser::$current_entity = ""
protected

Definition at line 17 of file class.ilDataSetImportParser.php.

Referenced by handleEndTag().

ilDataSetImportParser::$current_field = ""
protected

Definition at line 22 of file class.ilDataSetImportParser.php.

Referenced by handleEndTag().

ilDataSetImportParser::$current_field_values = array()
protected

Definition at line 23 of file class.ilDataSetImportParser.php.

ilDataSetImportParser::$current_ftypes = array()
protected

Definition at line 19 of file class.ilDataSetImportParser.php.

ilDataSetImportParser::$current_version = ""
protected

Definition at line 18 of file class.ilDataSetImportParser.php.

ilDataSetImportParser::$entities = array()
protected

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

ilDataSetImportParser::$entities_sent = false
protected

Definition at line 20 of file class.ilDataSetImportParser.php.

ilDataSetImportParser::$import = null
protected

Definition at line 15 of file class.ilDataSetImportParser.php.

ilDataSetImportParser::$in_record = false
protected

Definition at line 21 of file class.ilDataSetImportParser.php.


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