ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $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

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

Constructor & Destructor Documentation

◆ __construct()

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

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

42 {
43 $this->poolOBJ = $poolOBJ;
44
45 $this->inSettingsTag = false;
46 $this->inMetaDataTag = false;
47 $this->inMdGeneralTag = false;
48
49 parent::__construct($xmlFile);
50 }
__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 58 of file class.ilObjQuestionPoolXMLParser.php.

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

Referenced by setHandlers().

+ Here is the caller graph for this function:

◆ handlerCharacterData()

ilObjQuestionPoolXMLParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

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

Referenced by setHandlers().

+ Here is the caller graph for this function:

◆ handlerEndTag()

ilObjQuestionPoolXMLParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

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

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 52 of file class.ilObjQuestionPoolXMLParser.php.

52 : void
53 {
54 xml_set_element_handler($a_xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
55 xml_set_character_data_handler($a_xml_parser, $this->handlerCharacterData(...));
56 }
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 35 of file class.ilObjQuestionPoolXMLParser.php.

◆ $description_processed

bool ilObjQuestionPoolXMLParser::$description_processed = false
private

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

◆ $inMdGeneralTag

ilObjQuestionPoolXMLParser::$inMdGeneralTag
private

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

◆ $inMetaDataTag

ilObjQuestionPoolXMLParser::$inMetaDataTag
private

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

◆ $inSettingsTag

ilObjQuestionPoolXMLParser::$inSettingsTag
private

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

◆ $poolOBJ

ilObjQuestionPool ilObjQuestionPoolXMLParser::$poolOBJ
private

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

Referenced by __construct().

◆ $title_processed

bool ilObjQuestionPoolXMLParser::$title_processed = false
private

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


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