Public Member Functions | Data Fields

ilObjectXMLParser Class Reference

Inheritance diagram for ilObjectXMLParser:
Collaboration diagram for ilObjectXMLParser:

Public Member Functions

 ilObjectXMLParser ($a_xml_data= '')
 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)

Data Fields

 $object_data = array()

Detailed Description

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


Member Function Documentation

ilObjectXMLParser::__addProperty ( a_name,
a_value 
)

Definition at line 194 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 199 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 56 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_parser xml parser
string $a_name element name
array $a_attribs element attributes array

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

References __addProperty().

        {
                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',$a_attribs['obj_id']);
                                break;

                        case 'Title':
                                break;

                        case 'Description':
                                break;

                        case 'Owner':
                                break;

                        case 'CreateDate':
                                break;

                        case 'LastUpdate':
                                break;
                                
                        case 'ImportId':
                                break;

                        case 'References':
                                break;
                }
        }

Here is the call graph for this function:

ilObjectXMLParser::handlerCharacterData ( a_xml_parser,
a_data 
)

handler for character data

Parameters:
resource $a_xml_parser xml parser
string $a_data character data

Definition at line 180 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_parser xml parser
string $a_name element name

Definition at line 130 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(trim($this->cdata));
                                break;
                }

                $this->cdata = '';

                return;
        }

Here is the call graph for this function:

ilObjectXMLParser::ilObjectXMLParser ( a_xml_data = ''  ) 

Constructor.

Parameters:
object $a_content_object must be of type ilObjContentObject ilObjTest or ilObjQuestionPool
string $a_xml_file xml data
string $a_subdir subdirectory in import directory public

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

References ilSaxParser::ilSaxParser(), and ilSaxParser::setXMLContent().

        {
                parent::ilSaxParser();
                $this->setXMLContent($a_xml_data);
        }

Here is the call graph for this function:

ilObjectXMLParser::setHandlers ( a_xml_parser  ) 

set event handlers

Parameters:
resource reference to the xml parser private

Reimplemented from ilSaxParser.

Definition at line 67 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 39 of file class.ilObjectXMLParser.php.


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