ILIAS  release_8 Revision v8.23
ilObjQuestionPoolXMLParser Class Reference
+ Inheritance diagram for ilObjQuestionPoolXMLParser:
+ Collaboration diagram for ilObjQuestionPoolXMLParser:

Public Member Functions

 __construct (ilObjQuestionPool $poolOBJ, ?string $xmlFile)
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($xmlParser, $tagName, $tagAttributes)
 
 handlerEndTag ($xmlParser, $tagName)
 
 handlerCharacterData ($xmlParser, $charData)
 
- Public Member Functions inherited from ilSaxParser
 __construct (?string $path_to_file='', ?bool $throw_exception=false)
 
 setXMLContent (string $a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 
 setHandlers ($a_xml_parser)
 
 parse ($a_xml_parser, $a_fp=null)
 

Private Attributes

ilObjQuestionPool $poolOBJ
 
 $inSettingsTag
 
 $inMetaDataTag
 
 $inMdGeneralTag
 
bool $descriptionProcessed = false
 
string $cdata = ""
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $poolOBJ, and ILIAS\GlobalScreen\Provider\__construct().

40  {
41  $this->poolOBJ = $poolOBJ;
42 
43  $this->inSettingsTag = false;
44  $this->inMetaDataTag = false;
45  $this->inMdGeneralTag = false;
46 
47  return parent::__construct($xmlFile);
48  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ handlerBeginTag()

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

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

57  : void
58  {
59  switch ($tagName) {
60  case 'MetaData':
61  $this->inMetaDataTag = true;
62  break;
63 
64  case 'General':
65  if ($this->inMetaDataTag) {
66  $this->inMdGeneralTag = true;
67  }
68  break;
69 
70  case 'Description':
71  if ($this->inMetaDataTag && $this->inMdGeneralTag) {
72  $this->cdata = '';
73  }
74  break;
75 
76  case 'Settings':
77  $this->inSettingsTag = true;
78  break;
79 
80  case 'ShowTaxonomies':
81  case 'NavTaxonomy':
82  case 'SkillService':
83  if ($this->inSettingsTag) {
84  $this->cdata = '';
85  }
86  break;
87  }
88  }

◆ handlerCharacterData()

ilObjQuestionPoolXMLParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

132  : void
133  {
134  if ($charData != "\n") {
135  // Replace multiple tabs with one space
136  $charData = preg_replace("/\t+/", " ", $charData);
137 
138  $this->cdata .= $charData;
139  }
140  }

◆ handlerEndTag()

ilObjQuestionPoolXMLParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

90  : void
91  {
92  switch ($tagName) {
93  case 'MetaData':
94  $this->inMetaDataTag = false;
95  break;
96 
97  case 'General':
98  if ($this->inMetaDataTag) {
99  $this->inMdGeneralTag = false;
100  }
101  break;
102 
103  case 'Description':
104  if ($this->inMetaDataTag && $this->inMdGeneralTag && !$this->descriptionProcessed) {
105  $this->poolOBJ->setDescription($this->cdata);
106  $this->descriptionProcessed = true;
107  $this->cdata = '';
108  }
109  break;
110 
111  case 'Settings':
112  $this->inSettingsTag = false;
113  break;
114 
115  case 'ShowTaxonomies':
116  $this->poolOBJ->setShowTaxonomies((bool) $this->cdata);
117  $this->cdata = '';
118  break;
119 
120  case 'NavTaxonomy':
121  $this->poolOBJ->setNavTaxonomyId((int) $this->cdata);
122  $this->cdata = '';
123  break;
124 
125  case 'SkillService':
126  $this->poolOBJ->setSkillServiceEnabled((bool) $this->cdata);
127  $this->cdata = '';
128  break;
129  }
130  }

◆ setHandlers()

ilObjQuestionPoolXMLParser::setHandlers (   $a_xml_parser)

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

50  : void
51  {
52  xml_set_object($a_xml_parser, $this);
53  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
54  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
55  }

Field Documentation

◆ $cdata

string ilObjQuestionPoolXMLParser::$cdata = ""
private

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

◆ $descriptionProcessed

bool ilObjQuestionPoolXMLParser::$descriptionProcessed = false
private

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

◆ $inMdGeneralTag

ilObjQuestionPoolXMLParser::$inMdGeneralTag
private

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

◆ $inMetaDataTag

ilObjQuestionPoolXMLParser::$inMetaDataTag
private

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

◆ $inSettingsTag

ilObjQuestionPoolXMLParser::$inSettingsTag
private

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

◆ $poolOBJ

ilObjQuestionPool ilObjQuestionPoolXMLParser::$poolOBJ
private

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

Referenced by __construct().


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