ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilXmlWriter Class Reference

XML writer class. More...

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

Public Member Functions

 ilXmlWriter ($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...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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...
 

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.

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()

ilXmlWriter::_xmlEscapeData (   $data)

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 {
140 $character = substr($data, $position, 1);
141 $code = Ord($character);
142
143 switch($code)
144 {
145 case 34:
146 $character = "&quot;";
147 break;
148
149 case 38:
150 $character = "&amp;";
151 break;
152
153 case 39:
154 $character = "&apos;";
155 break;
156
157 case 60:
158 $character = "&lt;";
159 break;
160
161 case 62:
162 $character = "&gt;";
163 break;
164
165 default:
166 if ($code < 32)
167 {
168 $character = ("&#".strval($code).";");
169 }
170 break;
171 }
172
173 $escapedData .= $character;
174 $position ++;
175 }
176 return $escapedData;
177 }
$data
$code
Definition: example_050.php:99

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 505 of file class.ilXmlWriter.php.

506 {
507 $this->xmlStr .= $a_str;
508 }

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

+ Here is the caller graph for this function:

◆ ilXmlWriter()

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

constructor

Parameters
stringxml version
stringoutput encoding
stringinput encoding @access public

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.

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr @access public

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

515 {
516 // reset xml string
517 $this->xmlStr = "";
518 }

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 385 of file class.ilXmlWriter.php.

386 {
387 $this->xmlStr .= "<!--".$comment."-->";
388 }

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 397 of file class.ilXmlWriter.php.

398 {
399 // encode
400 if ($encode)
401 {
402 $data = $this->xmlEncodeData($data);
403 }
404
405 // escape
406 if ($escape)
407 {
409 }
410
411 $this->xmlStr .= $data;
412 }
xmlEncodeData($data)
Encodes text from input encoding into output encoding.
_xmlEscapeData($data)
Escapes reserved characters.

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

Referenced by ilContainer\_exportContainerSettings(), 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 452 of file class.ilXmlWriter.php.

453 {
454 // open file
455 if (!($fp = @fopen($file,"w+")))
456 {
457 die ("<b>Error</b>: Could not open \"".$file."\" for writing".
458 " in <b>".__FILE__."</b> on line <b>".__LINE__."</b><br />");
459 }
460
461 // set file permissions
462 chmod($file, 0770);
463
464 // format xml data
465 if ($format)
466 {
467 $xmlStr = $this->xmlFormatData($this->xmlStr);
468 }
469 else
470 {
472 }
473
474 // write xml data into the file
475 fwrite($fp, $xmlStr);
476
477 // close file
478 fclose($fp);
479 }
print $file
xmlFormatData($data)
Indents text for better reading.

References $file, $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 487 of file class.ilXmlWriter.php.

488 {
489 // format xml data
490 if ($format)
491 {
492 $xmlStr = $this->xmlFormatData($this->xmlStr);
493 }
494 else
495 {
497 }
498
499 return $xmlStr;
500 }

References $xmlStr, and xmlFormatData().

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

+ 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 423 of file class.ilXmlWriter.php.

424 {
425 // check for existing data (element's content)
426 if (is_string($data) or
427 is_integer($data) or
428 is_float($data))
429 {
430 // write starttag
431 $this->xmlStartTag($tag, $attrs, FALSE, $encode, $escape);
432
433 // write text
434 $this->xmlData($data, $encode, $escape);
435
436 // write endtag
437 $this->xmlEndTag($tag);
438 }
439 else // no data
440 {
441 // write starttag (= empty tag)
442 $this->xmlStartTag($tag, $attrs, TRUE, $encode, $escape);
443 }
444 }
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.

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

Referenced by ilUserXMLWriter\__addElement(), ilObjectXMLWriter\__appendObject(), ilObjectXMLWriter\__appendObjectProperties(), ilObjectXMLWriter\__appendOperations(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilGroupXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilSoapInstallationInfoXMLWriter\__buildInstallationInfo(), ilGroupXMLWriter\__buildMember(), ilGroupXMLWriter\__buildRegistration(), ilCourseXMLWriter\__buildSetting(), ilGroupXMLWriter\__buildTitleDescription(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainerSortingSettings\_exportContainerSortingSettings(), ilLPXmlWriter\addLPInformation(), ilAdvancedMDFieldDefinitionFloat\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\addPropertiesToXML(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), assQuestionExport\addQtiMetaDataField(), ilSoapLearningProgressAdministration\addUserProgress(), ilExerciseXMLWriter\attachMarking(), ilContainerReferenceXmlWriter\buildTarget(), ilContainerReferenceXmlWriter\buildTitle(), ilCategoryXmlWriter\buildTranslations(), ilTestResultsToXML\exportActiveIDs(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestQuestions(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilExerciseXMLWriter\handleAssignmentFiles(), 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(), ilLORandomTestQuestionPools\toXml(), ilLOTestAssignments\toXml(), ilFolderXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), and ilRoleXmlExport\writeRole().

+ 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 185 of file class.ilXmlWriter.php.

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

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 375 of file class.ilXmlWriter.php.

376 {
377 $this->xmlStr .= "</".$tag.">";
378 }

Referenced by ilObjectXMLWriter\__appendObject(), 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\__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(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestQuestions(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), 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(), ilFolderXmlWriter\write(), ilRoleXmlExport\write(), ilAdvancedMDRecordXMLWriter\write(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), 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 233 of file class.ilXmlWriter.php.

234 {
235 // regular expression for tags
236 $formatedXml = preg_replace_callback("|<[^>]*>[^<]*|", array($this, "xmlFormatElement"), $data);
237
238 return $formatedXml;
239 }

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 247 of file class.ilXmlWriter.php.

248 {
249 $found = trim($array[0]);
250
251 static $indent;
252
253 // linebreak (default)
254 $nl = "\n";
255
256 $tab = str_repeat(" ", $indent * 2);
257
258 // closing tag
259 if (substr($found, 0, 2) == "</")
260 {
261 if($indent)
262 {
263 $indent --;
264 }
265 $tab = str_repeat(" ", $indent * 2);
266 }
267 elseif (substr($found, -2, 1) == "/" or // opening and closing, comment, ...
268 strpos($found, "/>") or
269 substr($found, 0, 2) == "<!")
270 {
271 // do not change indent
272 }
273 elseif (substr($found, 0, 2) == "<?")
274 {
275 // do not change indent
276 // no linebreak
277 $nl = "";
278 }
279 else // opening tag
280 {
281 $indent ++;
282 }
283
284 // content
285 if (substr($found, -1) != ">")
286 {
287 $found = str_replace(">", ">\n".str_repeat(" ", ($indent + 0) * 2), $found);
288 }
289
290 return $nl.$tab.$found;
291 }

References $tab.

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header @access public.

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

298 {
299 // version and encoding
300 $this->xmlStr .= "<?xml version=\"".$this->version."\" encoding=\"".$this->outEnc."\"?>";
301
302 // dtd definition
303 if ($this->dtdDef <> "")
304 {
305 $this->xmlStr .= $this->dtdDef;
306 }
307
308 // stSheet
309 if ($this->stSheet <> "")
310 {
311 $this->xmlStr .= $this->stSheet;
312 }
313
314 // generated comment
315 if ($this->genCmt <> "")
316 {
317 $this->xmlComment($this->genCmt);
318 }
319
320 return $xmlStr;
321 }
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(), ilWebLinkXmlWriter\buildHeader(), ilAdvancedMDRecordXMLWriter\buildHeader(), ilContainerXmlWriter\buildHeader(), ilContainerReferenceXmlWriter\buildHeader(), ilLPXmlWriter\buildHeader(), ilContObjectManifestBuilder\buildManifest(), ilTestResultsToXML\getXML(), assClozeTestExport\toXML(), assErrorTextExport\toXML(), assFileUploadExport\toXML(), assFlashQuestionExport\toXML(), assFormulaQuestionExport\toXML(), assImagemapQuestionExport\toXML(), assJavaAppletExport\toXML(), assKprimChoiceExport\toXML(), assLongMenuExport\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 332 of file class.ilXmlWriter.php.

333 {
334 // write first part of the starttag
335 $this->xmlStr .= "<".$tag;
336
337 // check for existing attributes
338 if (is_array($attrs))
339 {
340 // write attributes
341 foreach ($attrs as $name => $value)
342 {
343 // encode
344 if ($encode)
345 {
346 $value = $this->xmlEncodeData($value);
347 }
348
349 // escape
350 if ($escape)
351 {
352 $value = ilXmlWriter::_xmlEscapeData($value);
353 }
354
355 $this->xmlStr .= " ".$name."=\"".$value."\"";
356 }
357 }
358
359 // write last part of the starttag
360 if ($empty)
361 {
362 $this->xmlStr .= "/>";
363 }
364 else
365 {
366 $this->xmlStr .= ">";
367 }
368 }

References _xmlEscapeData(), and xmlEncodeData().

Referenced by ilObjectXMLWriter\__appendObject(), 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\__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(), ilTestResultsToXML\exportPassResult(), ilObjSCORM2004LearningModule\exportPDF(), ilSCORM2004Asset\exportPDF(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestQuestions(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilAdvancedMetaDataExporter\getXmlRepresentation(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), 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(), ilFolderXmlWriter\write(), ilRoleXmlExport\write(), ilAdvancedMDRecordXMLWriter\write(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), 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 ilXmlWriter().

◆ $outEnc

ilXmlWriter::$outEnc

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

Referenced by ilXmlWriter().

◆ $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 ilXmlWriter(), 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: