ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilXmlWriter Class Reference

XML writer class. More...

+ Inheritance diagram for ilXmlWriter:
+ Collaboration diagram for ilXmlWriter:

Public Member Functions

 __construct ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor @access public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatData ($data)
 Indents text for better reading. More...
 
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlHeader ()
 Writes xml header @access public. More...
 
 xmlStartTag ($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
 Writes a starttag. More...
 
 xmlEndTag ($tag)
 Writes an endtag. More...
 
 xmlComment ($comment)
 Writes a comment. More...
 
 xmlData ($data, $encode=true, $escape=true)
 Writes data. More...
 
 xmlElement ($tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile ($file, $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem ($format=true)
 Returns xml document from memory. More...
 
 appendXML ($a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr @access public More...
 

Static Public Member Functions

static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 

Data Fields

 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Detailed Description

XML writer class.

Class to simplify manual writing of xml documents. It only supports writing xml sequentially, because the xml document is saved in a string with no additional structure information. The author is responsible for well-formedness and validity of the xml document.

Author
Matthias Rulinski matth.nosp@m.ias..nosp@m.rulin.nosp@m.ski@.nosp@m.mi.un.nosp@m.i-ko.nosp@m.eln.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilXmlWriter::__construct (   $version = "1.0",
  $outEnc = "utf-8",
  $inEnc = "utf-8" 
)

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding @access public

Reimplemented in ilMD2XML.

Definition at line 75 of file class.ilXmlWriter.php.

76 {
77 // initialize xml string
78 $this->xmlStr = "";
79
80 // set properties
81 $this->version = $version;
82 $this->outEnc = $outEnc;
83 $this->inEnc = $inEnc;
84 }

References $inEnc, $outEnc, and $version.

Member Function Documentation

◆ _ilXmlWriter()

ilXmlWriter::_ilXmlWriter ( )

destructor @access public

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

91 {
92 // terminate xml string
93 unset($this->xmlStr);
94 }

◆ _xmlEscapeData()

static ilXmlWriter::_xmlEscapeData (   $data)
static

Escapes reserved characters.

Parameters
stringinput text
Returns
string escaped text @access static

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

133 {
134 $position = 0;
135 $length = strlen($data);
136 $escapedData = "";
137
138 for (; $position < $length;) {
139 $character = substr($data, $position, 1);
140 $code = Ord($character);
141
142 switch ($code) {
143 case 34:
144 $character = "&quot;";
145 break;
146
147 case 38:
148 $character = "&amp;";
149 break;
150
151 case 39:
152 $character = "&apos;";
153 break;
154
155 case 60:
156 $character = "&lt;";
157 break;
158
159 case 62:
160 $character = "&gt;";
161 break;
162
163 default:
164 if ($code < 32) {
165 $character = ("&#" . strval($code) . ";");
166 }
167 break;
168 }
169
170 $escapedData .= $character;
171 $position++;
172 }
173 return $escapedData;
174 }
$code
Definition: example_050.php:99
$data
Definition: bench.php:6

References $code, and $data.

Referenced by xmlData(), and xmlStartTag().

+ Here is the caller graph for this function:

◆ appendXML()

ilXmlWriter::appendXML (   $a_str)

append xml string to document

Definition at line 461 of file class.ilXmlWriter.php.

462 {
463 $this->xmlStr .= $a_str;
464 }

Referenced by ilCourseXMLWriter\__buildMetaData(), ilGroupXMLWriter\__buildMetaData(), ilObjLinkResource\toXML(), ilDidacticTemplateLocalPolicyAction\toXml(), and ilDidacticTemplateLocalRoleAction\toXml().

+ Here is the caller graph for this function:

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr @access public

Definition at line 470 of file class.ilXmlWriter.php.

471 {
472 // reset xml string
473 $this->xmlStr = "";
474 }

Referenced by ilFolderXmlWriter\init(), ilWebLinkXmlWriter\init(), and ilLPXmlWriter\init().

+ Here is the caller graph for this function:

◆ xmlComment()

ilXmlWriter::xmlComment (   $comment)

Writes a comment.

Parameters
stringcomment @access public

Definition at line 353 of file class.ilXmlWriter.php.

354 {
355 $this->xmlStr .= "<!--" . $comment . "-->";
356 }
$comment
Definition: buildRTE.php:83

References $comment.

Referenced by xmlHeader().

+ Here is the caller graph for this function:

◆ xmlData()

ilXmlWriter::xmlData (   $data,
  $encode = true,
  $escape = true 
)

Writes data.

Parameters
stringdata
stringecode data (TRUE) or not (FALSE)
stringescape data (TRUE) or not (FALSE) @access public

Definition at line 365 of file class.ilXmlWriter.php.

366 {
367 // encode
368 if ($encode) {
369 $data = $this->xmlEncodeData($data);
370 }
371
372 // escape
373 if ($escape) {
375 }
376
377 $this->xmlStr .= $data;
378 }
static _xmlEscapeData($data)
Escapes reserved characters.
xmlEncodeData($data)
Encodes text from input encoding into output encoding.

References $data, _xmlEscapeData(), and xmlEncodeData().

Referenced by ilContainer\_exportContainerSettings(), ilTestExportRandomQuestionSet\populateQuestionStages(), and xmlElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlDumpFile()

ilXmlWriter::xmlDumpFile (   $file,
  $format = true 
)

Dumps xml document from memory into a file.

Parameters
stringfile name (full path)
booleanindent text (TRUE) or not (FALSE) @access public

Reimplemented in ilTestResultsToXML.

Definition at line 415 of file class.ilXmlWriter.php.

416 {
417 // open file
418 if (!($fp = @fopen($file, "w+"))) {
419 die("<b>Error</b>: Could not open \"" . $file . "\" for writing" .
420 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
421 }
422
423 // set file permissions
424 chmod($file, 0770);
425
426 // format xml data
427 if ($format) {
428 $xmlStr = $this->xmlFormatData($this->xmlStr);
429 } else {
431 }
432
433 // write xml data into the file
434 fwrite($fp, $xmlStr);
435
436 // close file
437 fclose($fp);
438 }
xmlFormatData($data)
Indents text for better reading.
$format
Definition: metadata.php:141

References $format, $xmlStr, and xmlFormatData().

+ Here is the call graph for this function:

◆ xmlDumpMem()

ilXmlWriter::xmlDumpMem (   $format = true)

Returns xml document from memory.

Parameters
booleanindent text (TRUE) or not (FALSE)
Returns
string xml document @access public

Reimplemented in ilTestResultsToXML.

Definition at line 446 of file class.ilXmlWriter.php.

447 {
448 // format xml data
449 if ($format) {
450 $xmlStr = $this->xmlFormatData($this->xmlStr);
451 } else {
453 }
454
455 return $xmlStr;
456 }

References $format, $xmlStr, and xmlFormatData().

Referenced by ilCategoryXmlWriter\getXml(), ilChatroomXMLWriter\getXML(), ilCourseXMLWriter\getXML(), ilExerciseXMLWriter\getXML(), ilFileXMLWriter\getXML(), ilForumXMLWriter\getXML(), ilGroupXMLWriter\getXML(), ilLearningSequenceXMLWriter\getXml(), ilContainerReferenceXmlWriter\getXml(), ilMD2XML\getXML(), ilUserXMLWriter\getXML(), ilObjectXMLWriter\getXML(), ilSoapInstallationInfoXMLWriter\getXML(), ilSoapRoleObjectXMLWriter\getXML(), ilSoapStructureObjectXMLWriter\getXML(), and ilXMLResultSetWriter\getXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlElement()

ilXmlWriter::xmlElement (   $tag,
  $attrs = null,
  $data = null,
  $encode = true,
  $escape = true 
)

Writes a basic element (no children, just textual content)

Parameters
stringtag name
arrayattributes (name => value)
stringdata
booleanecode attributes' values and data (TRUE) or not (FALSE)
booleanescape attributes' values and data (TRUE) or not (FALSE) @access public

Definition at line 389 of file class.ilXmlWriter.php.

390 {
391 // check for existing data (element's content)
392 if (is_string($data) or
393 is_integer($data) or
394 is_float($data)) {
395 // write starttag
396 $this->xmlStartTag($tag, $attrs, false, $encode, $escape);
397
398 // write text
399 $this->xmlData($data, $encode, $escape);
400
401 // write endtag
402 $this->xmlEndTag($tag);
403 } else { // no data
404 // write starttag (= empty tag)
405 $this->xmlStartTag($tag, $attrs, true, $encode, $escape);
406 }
407 }
xmlEndTag($tag)
Writes an endtag.
xmlData($data, $encode=true, $escape=true)
Writes data.
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35

References $data, $tag, xmlData(), xmlEndTag(), and xmlStartTag().

Referenced by ilUserXMLWriter\__addElement(), ilObjectXMLWriter\__appendObjectProperties(), ilObjectXMLWriter\__appendOperations(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilGroupXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilGroupXMLWriter\__buildExtraSettings(), ilSoapInstallationInfoXMLWriter\__buildInstallationInfo(), ilGroupXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilCourseXMLWriter\__buildSetting(), ilGroupXMLWriter\__buildTitleDescription(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilLPXmlWriter\addLPInformation(), ilAdvancedMDFieldDefinitionFloat\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\addPropertiesToXML(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), assQuestionExport\addQtiMetaDataField(), ilSoapLearningProgressAdministration\addUserProgress(), ilExerciseXMLWriter\attachMarking(), ilContainerReferenceXmlWriter\buildTarget(), ilContainerReferenceXmlWriter\buildTitle(), ilCategoryXmlWriter\buildTranslations(), ilAuthProviderSaml\buildUserAttributeXml(), ilTestResultsToXML\exportActiveIDs(), ilChatroomXMLWriter\exportData(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilTestExportRandomQuestionSet\populateCommonSettings(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilForumXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjective\toXml(), ilCourseObjectiveMaterials\toXml(), ilCourseObjectiveQuestion\toXml(), ilLOSettings\toXml(), ilLinkResourceItems\toXML(), ilObjLinkResource\toXML(), ilAdvancedMDRecord\toXML(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilDidacticTemplateIncludeFilterPattern\toXml(), ilDidacticTemplateSetting\toXml(), ilMultilingualism\toXml(), ilLORandomTestQuestionPools\toXml(), ilLOTestAssignments\toXml(), ilFolderXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeDescription(), ilLearningSequenceXMLWriter\writeLPSettings(), ilLearningSequenceXMLWriter\writeLSItems(), ilLearningSequenceXMLWriter\writeOwner(), ilRoleXmlExport\writeRole(), ilLearningSequenceXMLWriter\writeSettings(), and ilLearningSequenceXMLWriter\writeTitle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlEncodeData()

ilXmlWriter::xmlEncodeData (   $data)

Encodes text from input encoding into output encoding.

Parameters
stringinput text
Returns
string encoded text @access private

Definition at line 182 of file class.ilXmlWriter.php.

183 {
184 if ($this->inEnc == $this->outEnc) {
185 $encodedData = $data;
186 } else {
187 switch (strtolower($this->outEnc)) {
188 case "utf-8":
189 if (strtolower($this->inEnc) == "iso-8859-1") {
190 $encodedData = utf8_encode($data);
191 } else {
192 die("<b>Error</b>: Cannot encode iso-8859-1 data in " . $this->outEnc .
193 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
194 }
195 break;
196
197 case "iso-8859-1":
198 if (strtolower($this->inEnc) == "utf-8") {
199 $encodedData = utf8_decode($data);
200 } else {
201 die("<b>Error</b>: Cannot encode utf-8 data in " . $this->outEnc .
202 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
203 }
204 break;
205
206 default:
207 die("<b>Error</b>: Cannot encode " . $this->inEnc . " data in " . $this->outEnc .
208 " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
209 }
210 }
211 return $encodedData;
212 }

References $data.

Referenced by xmlData(), and xmlStartTag().

+ Here is the caller graph for this function:

◆ xmlEndTag()

ilXmlWriter::xmlEndTag (   $tag)

Writes an endtag.

Parameters
stringtag name @access public

Definition at line 343 of file class.ilXmlWriter.php.

344 {
345 $this->xmlStr .= "</" . $tag . ">";
346 }

References $tag.

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilCourseXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilCourseXMLWriter\__buildFooter(), ilGroupXMLWriter\__buildFooter(), ilUserXMLWriter\__buildFooter(), ilObjectXMLWriter\__buildFooter(), ilSoapInstallationInfoXMLWriter\__buildFooter(), ilSoapRoleObjectXMLWriter\__buildFooter(), ilXMLResultSetWriter\__buildFooter(), ilSoapInstallationInfoXMLWriter\__buildInstallationInfo(), ilCourseXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilXMLResultSetWriter\__buildRows(), ilCourseXMLWriter\__buildSetting(), ilCourseXMLWriter\__buildSubscriber(), ilCourseXMLWriter\__buildTutor(), ilCourseXMLWriter\__buildWaitingList(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainer\_exportContainerSettings(), assQuestionExport\addAnswerSpecificFeedback(), ilLPXmlWriter\addLPInformation(), assQuestionExport\addQtiMetaDataField(), ilSoapLearningProgressAdministration\addUserProgress(), ilExerciseXMLWriter\attachMarking(), ilCategoryXmlWriter\buildFooter(), ilContainerReferenceXmlWriter\buildFooter(), ilCategoryXmlWriter\buildTranslations(), ilSoapInstallationInfoXMLWriter\end(), ilTestResultsToXML\exportActiveIDs(), assClozeTestExport\exportAnswerSpecificFeedbacks(), ilChatroomXMLWriter\exportData(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilForumXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjective\toXml(), ilCourseObjectiveQuestion\toXml(), ilLinkResourceItems\toXML(), ilObjLinkResource\toXML(), ilAdvancedMDRecord\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilDidacticTemplateLocalRoleAction\toXml(), ilDidacticTemplateSetting\toXml(), ilMultilingualism\toXml(), ilFolderXmlWriter\write(), ilRoleXmlExport\write(), ilAdvancedMDRecordXMLWriter\write(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeFooter(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

+ Here is the caller graph for this function:

◆ xmlFormatData()

ilXmlWriter::xmlFormatData (   $data)

Indents text for better reading.

Parameters
stringinput text
Returns
string indented text @access private

Definition at line 220 of file class.ilXmlWriter.php.

221 {
222 // regular expression for tags
223 $formatedXml = preg_replace_callback("|<[^>]*>[^<]*|", array($this, "xmlFormatElement"), $data);
224
225 return $formatedXml;
226 }

References $data.

Referenced by xmlDumpFile(), and xmlDumpMem().

+ Here is the caller graph for this function:

◆ xmlFormatElement()

ilXmlWriter::xmlFormatElement (   $array)

Callback function for xmlFormatData; do not invoke directly.

Parameters
arrayresult of reg. expr. search
Returns
string indented substring @access private

Definition at line 234 of file class.ilXmlWriter.php.

235 {
236 $found = trim($array[0]);
237
238 static $indent;
239
240 // linebreak (default)
241 $nl = "\n";
242
243 $tab = str_repeat(" ", $indent * 2);
244
245 // closing tag
246 if (substr($found, 0, 2) == "</") {
247 if ($indent) {
248 $indent--;
249 }
250 $tab = str_repeat(" ", $indent * 2);
251 } elseif (substr($found, -2, 1) == "/" or // opening and closing, comment, ...
252 strpos($found, "/>") or
253 substr($found, 0, 2) == "<!") {
254 // do not change indent
255 } elseif (substr($found, 0, 2) == "<?") {
256 // do not change indent
257 // no linebreak
258 $nl = "";
259 } else { // opening tag
260 $indent++;
261 }
262
263 // content
264 if (substr($found, -1) != ">") {
265 $found = str_replace(">", ">\n" . str_repeat(" ", ($indent + 0) * 2), $found);
266 }
267
268 return $nl . $tab . $found;
269 }

References $tab.

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header @access public.

Definition at line 275 of file class.ilXmlWriter.php.

276 {
277 // version and encoding
278 $this->xmlStr .= "<?xml version=\"" . $this->version . "\" encoding=\"" . $this->outEnc . "\"?>";
279
280 // dtd definition
281 if ($this->dtdDef <> "") {
282 $this->xmlStr .= $this->dtdDef;
283 }
284
285 // stSheet
286 if ($this->stSheet <> "") {
287 $this->xmlStr .= $this->stSheet;
288 }
289
290 // generated comment
291 if ($this->genCmt <> "") {
292 $this->xmlComment($this->genCmt);
293 }
294
295 return $xmlStr;
296 }
xmlComment($comment)
Writes a comment.

References $dtdDef, $stSheet, $xmlStr, and xmlComment().

Referenced by ilCourseXMLWriter\__buildHeader(), ilExerciseXMLWriter\__buildHeader(), ilFileXMLWriter\__buildHeader(), ilGroupXMLWriter\__buildHeader(), ilUserXMLWriter\__buildHeader(), ilObjectXMLWriter\__buildHeader(), ilSoapInstallationInfoXMLWriter\__buildHeader(), ilSoapRoleObjectXMLWriter\__buildHeader(), ilSoapStructureObjectXMLWriter\__buildHeader(), ilXMLResultSetWriter\__buildHeader(), ilCategoryXmlWriter\buildHeader(), ilCategoryReferenceXmlWriter\buildHeader(), ilCourseReferenceXmlWriter\buildHeader(), ilFolderXmlWriter\buildHeader(), ilGroupReferenceXmlWriter\buildHeader(), ilWebLinkXmlWriter\buildHeader(), ilAdvancedMDRecordXMLWriter\buildHeader(), ilContainerXmlWriter\buildHeader(), ilContainerReferenceXmlWriter\buildHeader(), ilLPXmlWriter\buildHeader(), ilContObjectManifestBuilder\buildManifest(), ilLMContObjectManifestBuilder\buildManifest(), ilTestResultsToXML\getXML(), assClozeTestExport\toXML(), assErrorTextExport\toXML(), assFileUploadExport\toXML(), assFlashQuestionExport\toXML(), assFormulaQuestionExport\toXML(), assImagemapQuestionExport\toXML(), assJavaAppletExport\toXML(), assMatchingQuestionExport\toXML(), assMultipleChoiceExport\toXML(), assNumericExport\toXML(), assOrderingHorizontalExport\toXML(), assOrderingQuestionExport\toXML(), assSingleChoiceExport\toXML(), assTextQuestionExport\toXML(), assTextSubsetExport\toXML(), SurveyMatrixQuestion\toXML(), SurveyMetricQuestion\toXML(), SurveyMultipleChoiceQuestion\toXML(), SurveySingleChoiceQuestion\toXML(), SurveyTextQuestion\toXML(), ilObjSurveyQuestionPool\toXML(), ilObjSurvey\toXML(), ilObjTest\toXML(), ilDidacticTemplateXmlWriter\write(), and ilRoleXmlExport\writeHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlSetDtdDef()

◆ xmlSetGenCmt()

◆ xmlSetStSheet()

ilXmlWriter::xmlSetStSheet (   $stSheet)

Sets stylesheet.

Parameters
stringstylesheet @access public

Definition at line 111 of file class.ilXmlWriter.php.

112 {
113 $this->stSheet = $stSheet;
114 }

References $stSheet.

◆ xmlStartTag()

ilXmlWriter::xmlStartTag (   $tag,
  $attrs = null,
  $empty = false,
  $encode = true,
  $escape = true 
)

Writes a starttag.

Parameters
stringtag name
arrayattributes (name => value)
booleantag empty (TRUE) or not (FALSE)
booleanecode attributes' values (TRUE) or not (FALSE)
booleanescape attributes' values (TRUE) or not (FALSE) @access public

Definition at line 307 of file class.ilXmlWriter.php.

308 {
309 // write first part of the starttag
310 $this->xmlStr .= "<" . $tag;
311
312 // check for existing attributes
313 if (is_array($attrs)) {
314 // write attributes
315 foreach ($attrs as $name => $value) {
316 // encode
317 if ($encode) {
318 $value = $this->xmlEncodeData($value);
319 }
320
321 // escape
322 if ($escape) {
323 $value = ilXmlWriter::_xmlEscapeData($value);
324 }
325
326 $this->xmlStr .= " " . $name . "=\"" . $value . "\"";
327 }
328 }
329
330 // write last part of the starttag
331 if ($empty) {
332 $this->xmlStr .= "/>";
333 } else {
334 $this->xmlStr .= ">";
335 }
336 }

References $name, $tag, _xmlEscapeData(), and xmlEncodeData().

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilCourseXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilCourseXMLWriter\__buildCourseStart(), ilGroupXMLWriter\__buildGroup(), ilUserXMLWriter\__buildHeader(), ilObjectXMLWriter\__buildHeader(), ilSoapInstallationInfoXMLWriter\__buildHeader(), ilSoapRoleObjectXMLWriter\__buildHeader(), ilXMLResultSetWriter\__buildHeader(), ilSoapInstallationInfoXMLWriter\__buildInstallationInfo(), ilCourseXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilXMLResultSetWriter\__buildRows(), ilCourseXMLWriter\__buildSetting(), ilCourseXMLWriter\__buildSubscriber(), ilCourseXMLWriter\__buildTutor(), ilCourseXMLWriter\__buildWaitingList(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainer\_exportContainerSettings(), assQuestionExport\addAnswerSpecificFeedback(), ilLPXmlWriter\addLPInformation(), assQuestionExport\addQtiMetaDataField(), ilSoapLearningProgressAdministration\addUserProgress(), ilExerciseXMLWriter\attachMarking(), ilCategoryXmlWriter\buildCategory(), ilContainerReferenceXmlWriter\buildReference(), ilCategoryXmlWriter\buildTranslations(), ilTestResultsToXML\exportActiveIDs(), assClozeTestExport\exportAnswerSpecificFeedbacks(), ilChatroomXMLWriter\exportData(), ilTestResultsToXML\exportPassResult(), ilObjSCORM2004LearningModule\exportPDF(), ilSCORM2004Asset\exportPDF(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilForumXMLWriter\start(), ilSoapInstallationInfoXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjective\toXml(), ilCourseObjectiveQuestion\toXml(), ilLinkResourceItems\toXML(), ilObjLinkResource\toXML(), ilAdvancedMDRecord\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilDidacticTemplateLocalRoleAction\toXml(), ilDidacticTemplateSetting\toXml(), ilMultilingualism\toXml(), ilFolderXmlWriter\write(), ilRoleXmlExport\write(), ilAdvancedMDRecordXMLWriter\write(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeLearningSequence(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $dtdDef

ilXmlWriter::$dtdDef = ""

Definition at line 52 of file class.ilXmlWriter.php.

Referenced by xmlHeader(), and xmlSetDtdDef().

◆ $genCmt

ilXmlWriter::$genCmt = "Generated by ILIAS XmlWriter"

Definition at line 66 of file class.ilXmlWriter.php.

Referenced by xmlSetGenCmt().

◆ $inEnc

ilXmlWriter::$inEnc

Definition at line 45 of file class.ilXmlWriter.php.

Referenced by __construct().

◆ $outEnc

ilXmlWriter::$outEnc

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

Referenced by __construct().

◆ $stSheet

ilXmlWriter::$stSheet = ""

Definition at line 59 of file class.ilXmlWriter.php.

Referenced by xmlHeader(), and xmlSetStSheet().

◆ $version

ilXmlWriter::$version

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

Referenced by __construct(), and ilFileXMLWriter\start().

◆ $xmlStr

ilXmlWriter::$xmlStr

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

Referenced by xmlDumpFile(), xmlDumpMem(), and xmlHeader().


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