ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilObjectXMLParser Class Reference

Object XML Parser. More...

+ Inheritance diagram for ilObjectXMLParser:
+ Collaboration diagram for ilObjectXMLParser:

Public Member Functions

 ilObjectXMLParser ($a_xml_data= '', $throwException=false)
 Constructor.
 getObjectData ()
 setHandlers ($a_xml_parser)
 set event handlers
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data
 __addProperty ($a_name, $a_value)
 __addReference ($a_value)
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file= '', $throwException=false)
 Constructor setup ILIAS global object public.
 setXMLContent ($a_xml_content)
 getXMLContent ()
 getInputType ()
 startParsing ()
 stores xml data in array
 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

Data Fields

 $object_data = array()
- Data Fields inherited from ilSaxParser
 $input_type = null
 $xml_content = ''
 $ilias
 $lng
 $xml_file
 $throwException = false

Additional Inherited Members

- 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

Object XML Parser.

Author
Stefan Meyer smeye.nosp@m.r@da.nosp@m.tabay.nosp@m..de
Version
Id:
class.ilObjectXMLParser.php 14543 2007-08-20 16:23:25Z rkuester

Definition at line 36 of file class.ilObjectXMLParser.php.

Member Function Documentation

ilObjectXMLParser::__addProperty (   $a_name,
  $a_value 
)

Definition at line 192 of file class.ilObjectXMLParser.php.

Referenced by handlerBeginTag(), and handlerEndTag().

{
$this->object_data[$this->curr_obj][$a_name] = $a_value;
}

+ Here is the caller graph for this function:

ilObjectXMLParser::__addReference (   $a_value)

Definition at line 197 of file class.ilObjectXMLParser.php.

Referenced by handlerEndTag().

{
if($a_value)
{
$this->object_data[$this->curr_obj]['references'][] = $a_value;
}
}

+ Here is the caller graph for this function:

ilObjectXMLParser::getObjectData ( )

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

{
return $this->object_data ? $this->object_data : array();
}
ilObjectXMLParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name
array$a_attribselement attributes array

Definition at line 83 of file class.ilObjectXMLParser.php.

References __addProperty(), and ilUtil\__extractId().

{
switch($a_name)
{
case 'Objects':
$this->curr_obj = -1;
break;
case 'Object':
++$this->curr_obj;
$this->__addProperty('type',$a_attribs['type']);
$this->__addProperty('obj_id',is_numeric($a_attribs['obj_id'])?(int) $a_attribs["obj_id"] : ilUtil::__extractId($a_attribs["obj_id"], IL_INST_ID));
break;
case 'Title':
break;
case 'Description':
break;
case 'Owner':
break;
case 'CreateDate':
break;
case 'LastUpdate':
break;
case 'ImportId':
break;
case 'References':
$this->ref_id = $a_attribs["ref_id"];
break;
}
}

+ Here is the call graph for this function:

ilObjectXMLParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Definition at line 178 of file class.ilObjectXMLParser.php.

{
if($a_data != "\n")
{
// Replace multiple tabs with one space
$a_data = preg_replace("/\t+/"," ",$a_data);
$this->cdata .= $a_data;
}
}
ilObjectXMLParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Definition at line 128 of file class.ilObjectXMLParser.php.

References __addProperty(), and __addReference().

{
switch($a_name)
{
case 'Objects':
break;
case 'Object':
break;
case 'Title':
$this->__addProperty('title',trim($this->cdata));
break;
case 'Description':
$this->__addProperty('description',trim($this->cdata));
break;
case 'Owner':
$this->__addProperty('owner',trim($this->cdata));
break;
case 'CreateDate':
$this->__addProperty('create_date',trim($this->cdata));
break;
case 'LastUpdate':
$this->__addProperty('last_update',trim($this->cdata));
break;
case 'ImportId':
$this->__addProperty('import_id',trim($this->cdata));
break;
case 'References':
$this->__addReference($this->ref_id);
break;
}
$this->cdata = '';
return;
}

+ Here is the call graph for this function:

ilObjectXMLParser::ilObjectXMLParser (   $a_xml_data = '',
  $throwException = false 
)

Constructor.

Parameters
object$a_content_objectmust be of type ilObjContentObject ilObjTest or ilObjQuestionPool
string$a_xml_filexml data
string$a_subdirsubdirectory in import directory public

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

References ilSaxParser\$throwException, ilSaxParser\ilSaxParser(), and ilSaxParser\setXMLContent().

{
$this->setXMLContent($a_xml_data);
}

+ Here is the call graph for this function:

ilObjectXMLParser::setHandlers (   $a_xml_parser)

set event handlers

Parameters
resourcereference to the xml parser private

Reimplemented from ilSaxParser.

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

{
xml_set_object($a_xml_parser,$this);
xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
}

Field Documentation

ilObjectXMLParser::$object_data = array()

Definition at line 38 of file class.ilObjectXMLParser.php.


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