ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilXmlWriter 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 ilXmlWriter:
+ Collaboration diagram for ilXmlWriter:

Public Member Functions

 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Private Member Functions

 xmlSetStSheet (string $stSheet)
 Sets stylesheet. More...
 
 xmlEscapeData (string $data)
 Escapes reserved characters. More...
 
 xmlEncodeData (string $data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatElement (array $array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlComment (string $comment)
 Writes a comment. More...
 

Private Attributes

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

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:
will be removed with ILIAS 11, use the PHP native XML writer instead.

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References $inEnc, $outEnc, and $version.

52  {
53  // initialize xml string
54  $this->xmlStr = "";
55 
56  // set properties
57  $this->version = $version;
58  $this->outEnc = $outEnc;
59  $this->inEnc = $inEnc;
60  }

Member Function Documentation

◆ appendXML()

ilXmlWriter::appendXML ( string  $a_str)

append xml string to document

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

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

391  : void
392  {
393  $this->xmlStr .= $a_str;
394  }
+ Here is the caller graph for this function:

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr

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

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

399  : void
400  {
401  // reset xml string
402  $this->xmlStr = "";
403  }
+ Here is the caller graph for this function:

◆ xmlComment()

ilXmlWriter::xmlComment ( string  $comment)
private

Writes a comment.

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

Referenced by xmlHeader().

289  : void
290  {
291  $this->xmlStr .= "<!--" . $comment . "-->";
292  }
$comment
Definition: buildRTE.php:72
+ Here is the caller graph for this function:

◆ xmlData()

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

Writes data.

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

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

Referenced by ilContainer\_exportContainerSettings(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateQuestionStages(), and xmlElement().

301  : void {
302  // encode
303  if ($encode) {
304  $data = $this->xmlEncodeData($data);
305  }
306 
307  // escape
308  if ($escape) {
309  $data = $this->xmlEscapeData($data);
310  }
311 
312  $this->xmlStr .= $data;
313  }
xmlEscapeData(string $data)
Escapes reserved characters.
xmlEncodeData(string $data)
Encodes text from input encoding into output encoding.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlDumpFile()

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

Dumps xml document from memory into a file.

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

References $xmlStr, and xmlFormatData().

346  : void
347  {
348  // open file
349  if (!($fp = fopen($file, "w+"))) {
350  throw new RuntimeException(
351  "<b>Error</b>: Could not open \"" . $file . "\" for writing" .
352  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"
353  );
354  }
355 
356  // set file permissions
357  chmod($file, 0770);
358 
359  // format xml data
360  if ($format) {
361  $xmlStr = $this->xmlFormatData($this->xmlStr);
362  } else {
364  }
365 
366  // write xml data into the file
367  fwrite($fp, $xmlStr);
368 
369  // close file
370  fclose($fp);
371  }
xmlFormatData(string $data)
Indents text for better reading.
+ Here is the call graph for this function:

◆ xmlDumpMem()

ilXmlWriter::xmlDumpMem ( bool  $format = true)

Returns xml document from memory.

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

References $xmlStr, and xmlFormatData().

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

376  : string
377  {
378  // format xml data
379  if ($format) {
380  $xmlStr = $this->xmlFormatData($this->xmlStr);
381  } else {
383  }
384 
385  return $xmlStr;
386  }
xmlFormatData(string $data)
Indents text for better reading.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlElement()

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

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

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

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

Referenced by ilUserXMLWriter\__addElement(), ilGroupXMLWriter\__buildAdmin(), ilGroupXMLWriter\__buildExtraSettings(), ilGroupXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilCourseXMLWriter\__buildSetting(), ilGroupXMLWriter\__buildTitleDescription(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainerSortingSettings\_exportContainerSortingSettings(), ilLMPageObject\_exportXMLAlias(), ilLPXmlWriter\addLPInformation(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), ilAdvancedMDFieldDefinitionGroupBased\addPropertiesToXML(), ilAdvancedMDFieldDefinitionFloat\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\addPropertiesToXML(), assQuestionExport\addQTIMaterial(), ilObjTest\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), assQuestionExport\addSolutionHints(), assQuestionExport\addSuggestedSolution(), ilUserDefinedData\addToXML(), ilUserDefinedFields\addToXML(), ilDataSet\addTypesXml(), ilSoapLearningProgressAdministration\addUserProgress(), ilObjectXMLWriter\appendObjectProperties(), ilObjectXMLWriter\appendOperations(), ilObjectXMLWriter\appendPathToObject(), ilXMLResultSetWriter\appendRow(), ilObjectXMLWriter\appendTimeTargets(), ilExerciseXMLWriter\attachMarking(), ilXMLResultSetWriter\buildColSpecs(), ilCourseReferenceXmlWriter\buildCourseSettings(), ilSoapInstallationInfoXMLWriter\buildInstallationInfo(), 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(), ilObjQuestionPool\exportTitleAndDescription(), ilSoapStructureObject\exportXML(), ilLMPageObject\exportXML(), ilGlossaryTerm\exportXML(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateCommonSettings(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilForumXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateIncludeFilterPattern\toXml(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilWebLinkItem\toXML(), ilWebLinkParameter\toXML(), ilMDFormat\toXML(), ilMDEntity\toXML(), ilMDIdentifier\toXML(), ilMDIdentifier_\toXML(), ilMDLocation\toXML(), ilMDDescription\toXML(), ilMDKeyword\toXML(), ilMDLanguage\toXML(), ilMDTaxon\toXML(), ilDidacticTemplateIconHandler\toXml(), ilMDAnnotation\toXML(), ilMDTypicalAgeRange\toXML(), ilMDTaxonPath\toXML(), ilObjLinkResource\toXML(), ilMDLifecycle\toXML(), ilMDContribute\toXML(), ilMDRights\toXML(), ilLOTestAssignments\toXml(), ilAdvancedMDRecordTranslations\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilMultilingualism\toXml(), ilLORandomTestQuestionPools\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilCourseObjectiveMaterials\toXml(), ilDidacticTemplateSetting\toXml(), ilLOSettings\toXml(), ilCourseObjective\toXml(), ilMDEducational\toXML(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilFolderXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeLearningSequence(), ilLearningSequenceXMLWriter\writeLPSettings(), ilLearningSequenceXMLWriter\writeLSItems(), and ilRoleXmlExport\writeRole().

324  : void {
325  // check for existing data (element's content)
326  if (is_string($data) or
327  is_integer($data) or
328  is_float($data)) {
329  // write starttag
330  $this->xmlStartTag($tag, $attrs, false, $encode, $escape);
331 
332  // write text
333  $this->xmlData($data, $encode, $escape);
334 
335  // write endtag
336  $this->xmlEndTag($tag);
337  } else { // no data
338  // write starttag (= empty tag)
339  $this->xmlStartTag($tag, $attrs, true, $encode, $escape);
340  }
341  }
xmlData(string $data, bool $encode=true, bool $escape=true)
Writes data.
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlEncodeData()

ilXmlWriter::xmlEncodeData ( string  $data)
private

Encodes text from input encoding into output encoding.

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

References $data.

Referenced by xmlData(), and xmlStartTag().

136  : string
137  {
138  if ($this->inEnc == $this->outEnc) {
139  $encodedData = $data;
140  } else {
141  throw new ilException(
142  'Differing in and out-encodings are not supported.'
143  );
144  }
145  return $encodedData;
146  }
+ Here is the caller graph for this function:

◆ xmlEndTag()

ilXmlWriter::xmlEndTag ( string  $tag)

Writes an endtag.

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

Referenced by ilCourseXMLWriter\__buildAdmin(), ilUserXMLWriter\__buildFooter(), ilGroupXMLWriter\__buildFooter(), ilCourseXMLWriter\__buildFooter(), ilCourseXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilCourseXMLWriter\__buildSetting(), ilCourseXMLWriter\__buildSubscriber(), ilCourseXMLWriter\__buildTutor(), ilCourseXMLWriter\__buildWaitingList(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainer\_exportContainerSettings(), ilLMPageObject\_exportXMLAlias(), assQuestionExport\addAnswerSpecificFeedback(), ilLPXmlWriter\addLPInformation(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestionExport\addQTIMaterial(), ilObjTest\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), assQuestionExport\addSuggestedSolution(), ilUserDefinedFields\addToXML(), ilDataSet\addTypesXml(), ilSoapLearningProgressAdministration\addUserProgress(), ilObjectXMLWriter\appendObjectProperties(), ilObjectXMLWriter\appendPathToObject(), ilXMLResultSetWriter\appendRow(), ilObjectXMLWriter\appendTimeTargets(), ilExerciseXMLWriter\attachMarking(), ilSoapInstallationInfoXMLWriter\buildClient(), ilXMLResultSetWriter\buildColSpecs(), ilSoapInstallationInfoXMLWriter\buildFooter(), ilXMLResultSetWriter\buildFooter(), ilCategoryXmlWriter\buildFooter(), ilContainerReferenceXmlWriter\buildFooter(), ilSoapRoleObjectXMLWriter\buildFooter(), ilObjectXMLWriter\buildFooter(), ilSoapInstallationInfoXMLWriter\buildInstallationInfo(), ilXMLResultSetWriter\buildRows(), ilCategoryXmlWriter\buildTranslations(), ilSoapInstallationInfoXMLWriter\end(), ilTestResultsToXML\exportActiveIDs(), assClozeTestExport\exportAnswerSpecificFeedbacks(), ilChatroomXMLWriter\exportData(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilStructureObject\exportXML(), ilSoapStructureObject\exportXML(), ilLMPageObject\exportXML(), ilGlossaryTerm\exportXML(), ilObjContentObject\exportXML(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ilObjQuestionPool\objectToXmlWriter(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateQuestionSetConfigXml(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateQuestionStages(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilForumXMLWriter\start(), ilFileXMLWriter\start(), ilWebLinkItem\toXML(), ilMDOrComposite\toXML(), ilDidacticTemplateLocalRoleAction\toXml(), ilMDAnnotation\toXML(), ilMDTaxonPath\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMDLifecycle\toXML(), ilMDContribute\toXML(), ilMDMetaMetadata\toXML(), ilMDRights\toXML(), ilMD\toXML(), ilMDRelation\toXML(), ilAdvancedMDRecordTranslations\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilMultilingualism\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilMDEducational\toXML(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilFolderXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilContainerXmlWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeFooter(), ilLearningSequenceXMLWriter\writeLPSettings(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

281  : void
282  {
283  $this->xmlStr .= "</" . $tag . ">";
284  }
+ Here is the caller graph for this function:

◆ xmlEscapeData()

ilXmlWriter::xmlEscapeData ( string  $data)
private

Escapes reserved characters.

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

Referenced by xmlData(), and xmlStartTag().

89  : string
90  {
91  $position = 0;
92  $length = strlen($data);
93  $escapedData = "";
94 
95  for (; $position < $length;) {
96  $character = substr($data, $position, 1);
97  $code = Ord($character);
98 
99  switch ($code) {
100  case 34:
101  $character = "&quot;";
102  break;
103 
104  case 38:
105  $character = "&amp;";
106  break;
107 
108  case 39:
109  $character = "&apos;";
110  break;
111 
112  case 60:
113  $character = "&lt;";
114  break;
115 
116  case 62:
117  $character = "&gt;";
118  break;
119 
120  default:
121  if ($code < 32) {
122  $character = ("&#" . $code . ";");
123  }
124  break;
125  }
126 
127  $escapedData .= $character;
128  $position++;
129  }
130  return $escapedData;
131  }
+ Here is the caller graph for this function:

◆ xmlFormatData()

ilXmlWriter::xmlFormatData ( string  $data)

Indents text for better reading.

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

Referenced by xmlDumpFile(), and xmlDumpMem().

151  : ?string
152  {
153  // regular expression for tags
154  $formatedXml = preg_replace_callback(
155  "|<[^>]*>[^<]*|",
156  [$this, "xmlFormatElement"],
157  $data
158  );
159 
160  return $formatedXml;
161  }
+ Here is the caller graph for this function:

◆ xmlFormatElement()

ilXmlWriter::xmlFormatElement ( array  $array)
private

Callback function for xmlFormatData; do not invoke directly.

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

166  : string
167  {
168  $found = trim($array[0]);
169 
170  static $indent;
171 
172  // linebreak (default)
173  $nl = "\n";
174 
175  $tab = str_repeat(" ", $indent * 2);
176 
177  // closing tag
178  if (substr($found, 0, 2) == "</") {
179  if ($indent) {
180  $indent--;
181  }
182  $tab = str_repeat(" ", $indent * 2);
183  } elseif (substr(
184  $found,
185  -2,
186  1
187  ) == "/" or // opening and closing, comment, ...
188  strpos($found, "/>") or
189  substr($found, 0, 2) == "<!") {
190  // do not change indent
191  } elseif (substr($found, 0, 2) == "<?") {
192  // do not change indent
193  // no linebreak
194  $nl = "";
195  } else { // opening tag
196  $indent++;
197  }
198 
199  // content
200  if (substr($found, -1) != ">") {
201  $found = str_replace(
202  ">",
203  ">\n" . str_repeat(" ", ($indent + 0) * 2),
204  $found
205  );
206  }
207 
208  return $nl . $tab . $found;
209  }

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header.

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

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

Referenced by ilUserXMLWriter\__buildHeader(), ilGroupXMLWriter\__buildHeader(), ilCourseXMLWriter\__buildHeader(), ilExerciseXMLWriter\__buildHeader(), ilFileXMLWriter\__buildHeader(), ilCategoryReferenceXmlWriter\buildHeader(), ilGroupReferenceXmlWriter\buildHeader(), ilXMLResultSetWriter\buildHeader(), ilSoapInstallationInfoXMLWriter\buildHeader(), ilFolderXmlWriter\buildHeader(), ilWebLinkXmlWriter\buildHeader(), ilAdvancedMDRecordXMLWriter\buildHeader(), ilSoapStructureObjectXMLWriter\buildHeader(), ilCourseReferenceXmlWriter\buildHeader(), ilContainerReferenceXmlWriter\buildHeader(), ilCategoryXmlWriter\buildHeader(), ilLPXmlWriter\buildHeader(), ilSoapRoleObjectXMLWriter\buildHeader(), ilContainerXmlWriter\buildHeader(), ilObjectXMLWriter\buildHeader(), ilTestResultsToXML\getXML(), ilDidacticTemplateXmlWriter\write(), and ilRoleXmlExport\writeHeader().

214  : void
215  {
216  // version and encoding
217  $this->xmlStr .= "<?xml version=\"" . $this->version . "\" encoding=\"" . $this->outEnc . "\"?>";
218 
219  // dtd definition
220  if ($this->dtdDef <> "") {
221  $this->xmlStr .= $this->dtdDef;
222  }
223 
224  // stSheet
225  if ($this->stSheet <> "") {
226  $this->xmlStr .= $this->stSheet;
227  }
228 
229  // generated comment
230  if ($this->genCmt <> "") {
231  $this->xmlComment($this->genCmt);
232  }
233  }
xmlComment(string $comment)
Writes a comment.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xmlSetDtdDef()

◆ xmlSetGenCmt()

◆ xmlSetStSheet()

ilXmlWriter::xmlSetStSheet ( string  $stSheet)
private

Sets stylesheet.

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

References $stSheet.

73  : void
74  {
75  $this->stSheet = $stSheet;
76  }

◆ xmlStartTag()

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

Writes a starttag.

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

References null, xmlEncodeData(), and xmlEscapeData().

Referenced by ilCourseXMLWriter\__buildAdmin(), ilCourseXMLWriter\__buildCourseStart(), ilGroupXMLWriter\__buildGroup(), ilUserXMLWriter\__buildHeader(), ilCourseXMLWriter\__buildMember(), ilGroupXMLWriter\__buildPeriod(), ilGroupXMLWriter\__buildRegistration(), ilCourseXMLWriter\__buildSetting(), ilCourseXMLWriter\__buildSubscriber(), ilCourseXMLWriter\__buildTutor(), ilCourseXMLWriter\__buildWaitingList(), ilUserXMLWriter\__handlePreferences(), ilUserXMLWriter\__handleUser(), ilAdvancedMDValues\_appendXMLByObjId(), ilContainer\_exportContainerSettings(), ilLMPageObject\_exportXMLAlias(), assQuestionExport\addAnswerSpecificFeedback(), ilLPXmlWriter\addLPInformation(), SurveyQuestion\addMaterialTag(), ilObjSurvey\addMaterialTag(), assQuestionExport\addQTIMaterial(), ilObjTest\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), assQuestionExport\addSuggestedSolution(), ilUserDefinedFields\addToXML(), ilDataSet\addTypesXml(), ilSoapLearningProgressAdministration\addUserProgress(), ilObjectXMLWriter\appendObjectProperties(), ilObjectXMLWriter\appendPathToObject(), ilXMLResultSetWriter\appendRow(), ilObjectXMLWriter\appendTimeTargets(), ilExerciseXMLWriter\attachMarking(), ilCategoryXmlWriter\buildCategory(), ilSoapInstallationInfoXMLWriter\buildClient(), ilXMLResultSetWriter\buildColSpecs(), ilXMLResultSetWriter\buildHeader(), ilSoapInstallationInfoXMLWriter\buildHeader(), ilSoapRoleObjectXMLWriter\buildHeader(), ilObjectXMLWriter\buildHeader(), ilSoapInstallationInfoXMLWriter\buildInstallationInfo(), ilContainerReferenceXmlWriter\buildReference(), ilXMLResultSetWriter\buildRows(), ilCategoryXmlWriter\buildTranslations(), ilTestResultsToXML\exportActiveIDs(), assClozeTestExport\exportAnswerSpecificFeedbacks(), ilChatroomXMLWriter\exportData(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilStructureObject\exportXML(), ilSoapStructureObject\exportXML(), ilLMPageObject\exportXML(), ilGlossaryTerm\exportXML(), ilObjContentObject\exportXML(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ilObjQuestionPool\objectToXmlWriter(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateQuestionSetConfigXml(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateQuestionStages(), ILIAS\Test\ExportImport\ExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapInstallationInfoXMLWriter\start(), ilChatroomXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilForumXMLWriter\start(), ilFileXMLWriter\start(), ilWebLinkItem\toXML(), ilMDOrComposite\toXML(), ilDidacticTemplateLocalRoleAction\toXml(), ilMDAnnotation\toXML(), ilMDTaxonPath\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMDLifecycle\toXML(), ilMDContribute\toXML(), ilMDMetaMetadata\toXML(), ilMDRights\toXML(), ilMD\toXML(), ilMDRelation\toXML(), ilAdvancedMDRecordTranslations\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilMultilingualism\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilMDEducational\toXML(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilFolderXmlWriter\write(), ilContainerXmlWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeLearningSequence(), ilLearningSequenceXMLWriter\writeLPSettings(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

244  : void {
245  // write first part of the starttag
246  $this->xmlStr .= "<" . $tag;
247 
248  // check for existing attributes
249  if (is_array($attrs)) {
250  // write attributes
251  foreach ($attrs as $name => $value) {
252  if ($value === null) {
253  $value = '';
254  }
255 
256  // encode
257  if ($encode) {
258  $value = $this->xmlEncodeData($value);
259  }
260 
261  // escape
262  if ($escape) {
263  $value = $this->xmlEscapeData($value);
264  }
265 
266  $this->xmlStr .= " " . $name . "=\"" . $value . "\"";
267  }
268  }
269 
270  // write last part of the starttag
271  if ($empty) {
272  $this->xmlStr .= "/>";
273  } else {
274  $this->xmlStr .= ">";
275  }
276  }
xmlEscapeData(string $data)
Escapes reserved characters.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
xmlEncodeData(string $data)
Encodes text from input encoding into output encoding.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $dtdDef

string ilXmlWriter::$dtdDef = ""
private

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

Referenced by xmlHeader(), and xmlSetDtdDef().

◆ $genCmt

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

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

Referenced by xmlSetGenCmt().

◆ $inEnc

string ilXmlWriter::$inEnc
private

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

Referenced by ilForumXMLWriter\__construct(), and __construct().

◆ $outEnc

string ilXmlWriter::$outEnc
private

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

Referenced by ilForumXMLWriter\__construct(), and __construct().

◆ $stSheet

string ilXmlWriter::$stSheet = ""
private

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

Referenced by xmlHeader(), and xmlSetStSheet().

◆ $version

string ilXmlWriter::$version
private

◆ $xmlStr

string ilXmlWriter::$xmlStr
private

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

Referenced by xmlDumpFile(), and xmlDumpMem().


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