ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilObjQuestionPoolXMLParser Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ 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 $title_processed = false
 
bool $description_processed = 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Deprecated:
This class is used only for legacy imports and will be removed in a future ILIAS release

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

Constructor & Destructor Documentation

◆ __construct()

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

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

39 {
40 $this->poolOBJ = $poolOBJ;
41
42 $this->inSettingsTag = false;
43 $this->inMetaDataTag = false;
44 $this->inMdGeneralTag = false;
45
46 parent::__construct($xmlFile);
47 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ Here is the call graph for this function:

Member Function Documentation

◆ handlerBeginTag()

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

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

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

Referenced by setHandlers().

+ Here is the caller graph for this function:

◆ handlerCharacterData()

ilObjQuestionPoolXMLParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

126 : void
127 {
128 if ($charData != "\n") {
129 // Replace multiple tabs with one space
130 $charData = preg_replace("/\t+/", " ", $charData);
131
132 $this->cdata .= $charData;
133 }
134 }

Referenced by setHandlers().

+ Here is the caller graph for this function:

◆ handlerEndTag()

ilObjQuestionPoolXMLParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

86 : void
87 {
88 switch ($tagName) {
89 case 'MetaData':
90 $this->inMetaDataTag = false;
91 break;
92
93 case 'General':
94 if ($this->inMetaDataTag) {
95 $this->inMdGeneralTag = false;
96 }
97 break;
98
99 case 'Title':
100 if (!$this->title_processed) {
101 $this->poolOBJ->setTitle($this->cdata);
102 $this->title_processed = true;
103 $this->cdata = '';
104 }
105 break;
106
107 case 'Description':
108 if (!$this->description_processed) {
109 $this->poolOBJ->setDescription($this->cdata);
110 $this->description_processed = true;
111 $this->cdata = '';
112 }
113 break;
114
115 case 'Settings':
116 $this->inSettingsTag = false;
117 break;
118
119 case 'SkillService':
120 $this->poolOBJ->setSkillServiceEnabled((bool) $this->cdata);
121 $this->cdata = '';
122 break;
123 }
124 }

Referenced by setHandlers().

+ Here is the caller graph for this function:

◆ setHandlers()

ilObjQuestionPoolXMLParser::setHandlers (   $a_xml_parser)
Parameters
XMLParser | resource$a_xml_parser
Returns
void

Reimplemented from ilSaxParser.

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

49 : void
50 {
51 xml_set_element_handler($a_xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
52 xml_set_character_data_handler($a_xml_parser, $this->handlerCharacterData(...));
53 }
handlerBeginTag($xmlParser, $tagName, $tagAttributes)

References handlerBeginTag(), handlerCharacterData(), and handlerEndTag().

+ Here is the call graph for this function:

Field Documentation

◆ $cdata

string ilObjQuestionPoolXMLParser::$cdata = ""
private

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

◆ $description_processed

bool ilObjQuestionPoolXMLParser::$description_processed = false
private

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

◆ $inMdGeneralTag

ilObjQuestionPoolXMLParser::$inMdGeneralTag
private

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

◆ $inMetaDataTag

ilObjQuestionPoolXMLParser::$inMetaDataTag
private

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

◆ $inSettingsTag

ilObjQuestionPoolXMLParser::$inSettingsTag
private

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

◆ $poolOBJ

ilObjQuestionPool ilObjQuestionPoolXMLParser::$poolOBJ
private

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

Referenced by __construct().

◆ $title_processed

bool ilObjQuestionPoolXMLParser::$title_processed = false
private

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


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