ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjQuestionPoolXMLParser Class Reference
+ Inheritance diagram for ilObjQuestionPoolXMLParser:
+ Collaboration diagram for ilObjQuestionPoolXMLParser:

Public Member Functions

 __construct (ilObjQuestionPool $poolOBJ, $xmlFile)
 
 setHandlers ($xmlParser)
 
 handlerBeginTag ($xmlParser, $tagName, $tagAttributes)
 
 handlerEndTag ($xmlParser, $tagName)
 
 handlerCharacterData ($xmlParser, $charData)
 
- Public Member Functions inherited from ilSaxParser
 __construct ($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
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). 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...
 
 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...
 

Private Attributes

 $poolOBJ
 
 $inSettingsTag
 
 $inMetaDataTag
 
 $inMdGeneralTag
 
 $descriptionProcessed = false
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & 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...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- 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

Definition at line 12 of file class.ilObjQuestionPoolXMLParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjQuestionPoolXMLParser::__construct ( ilObjQuestionPool  $poolOBJ,
  $xmlFile 
)
Parameters
ilObjQuestionPool$poolOBJ
$xmlFile

Definition at line 29 of file class.ilObjQuestionPoolXMLParser.php.

References $poolOBJ.

30  {
31  $this->poolOBJ = $poolOBJ;
32 
33  $this->inSettingsTag = false;
34  $this->inMetaDataTag = false;
35  $this->inMdGeneralTag = false;
36 
37  return parent::__construct($xmlFile);
38  }

Member Function Documentation

◆ handlerBeginTag()

ilObjQuestionPoolXMLParser::handlerBeginTag (   $xmlParser,
  $tagName,
  $tagAttributes 
)

Definition at line 47 of file class.ilObjQuestionPoolXMLParser.php.

48  {
49  switch ($tagName) {
50  case 'MetaData':
51  $this->inMetaDataTag = true;
52  break;
53 
54  case 'General':
55  if ($this->inMetaDataTag) {
56  $this->inMdGeneralTag = true;
57  }
58  break;
59 
60  case 'Description':
61  if ($this->inMetaDataTag && $this->inMdGeneralTag) {
62  $this->cdata = '';
63  }
64  break;
65 
66  case 'Settings':
67  $this->inSettingsTag = true;
68  break;
69 
70  case 'ShowTaxonomies':
71  case 'NavTaxonomy':
72  case 'SkillService':
73  if ($this->inSettingsTag) {
74  $this->cdata = '';
75  }
76  break;
77  }
78  }

◆ handlerCharacterData()

ilObjQuestionPoolXMLParser::handlerCharacterData (   $xmlParser,
  $charData 
)

Definition at line 122 of file class.ilObjQuestionPoolXMLParser.php.

123  {
124  if ($charData != "\n") {
125  // Replace multiple tabs with one space
126  $charData = preg_replace("/\t+/", " ", $charData);
127 
128  $this->cdata .= $charData;
129  }
130  }

◆ handlerEndTag()

ilObjQuestionPoolXMLParser::handlerEndTag (   $xmlParser,
  $tagName 
)

Definition at line 80 of file class.ilObjQuestionPoolXMLParser.php.

81  {
82  switch ($tagName) {
83  case 'MetaData':
84  $this->inMetaDataTag = false;
85  break;
86 
87  case 'General':
88  if ($this->inMetaDataTag) {
89  $this->inMdGeneralTag = false;
90  }
91  break;
92 
93  case 'Description':
94  if ($this->inMetaDataTag && $this->inMdGeneralTag && !$this->descriptionProcessed) {
95  $this->poolOBJ->setDescription($this->cdata);
96  $this->descriptionProcessed = true;
97  $this->cdata = '';
98  }
99  break;
100 
101  case 'Settings':
102  $this->inSettingsTag = false;
103  break;
104 
105  case 'ShowTaxonomies':
106  $this->poolOBJ->setShowTaxonomies((bool) $this->cdata);
107  $this->cdata = '';
108  break;
109 
110  case 'NavTaxonomy':
111  $this->poolOBJ->setNavTaxonomyId((int) $this->cdata);
112  $this->cdata = '';
113  break;
114 
115  case 'SkillService':
116  $this->poolOBJ->setSkillServiceEnabled((bool) $this->cdata);
117  $this->cdata = '';
118  break;
119  }
120  }

◆ setHandlers()

ilObjQuestionPoolXMLParser::setHandlers (   $xmlParser)

Definition at line 40 of file class.ilObjQuestionPoolXMLParser.php.

41  {
42  xml_set_object($xmlParser, $this);
43  xml_set_element_handler($xmlParser, 'handlerBeginTag', 'handlerEndTag');
44  xml_set_character_data_handler($xmlParser, 'handlerCharacterData');
45  }

Field Documentation

◆ $descriptionProcessed

ilObjQuestionPoolXMLParser::$descriptionProcessed = false
private

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

◆ $inMdGeneralTag

ilObjQuestionPoolXMLParser::$inMdGeneralTag
private

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

◆ $inMetaDataTag

ilObjQuestionPoolXMLParser::$inMetaDataTag
private

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

◆ $inSettingsTag

ilObjQuestionPoolXMLParser::$inSettingsTag
private

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

◆ $poolOBJ

ilObjQuestionPoolXMLParser::$poolOBJ
private

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

Referenced by __construct().


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