ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables 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 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 30 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 46 of file class.ilXmlWriter.php.

References $inEnc, $outEnc, and $version.

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

Member Function Documentation

◆ appendXML()

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr

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

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

423  : void
424  {
425  // reset xml string
426  $this->xmlStr = "";
427  }
+ Here is the caller graph for this function:

◆ xmlComment()

ilXmlWriter::xmlComment ( string  $comment)
private

Writes a comment.

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

Referenced by xmlHeader().

313  : void
314  {
315  $this->xmlStr .= "<!--" . $comment . "-->";
316  }
$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 321 of file class.ilXmlWriter.php.

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

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

325  : void {
326  // encode
327  if ($encode) {
328  $data = $this->xmlEncodeData($data);
329  }
330 
331  // escape
332  if ($escape) {
333  $data = $this->xmlEscapeData($data);
334  }
335 
336  $this->xmlStr .= $data;
337  }
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 370 of file class.ilXmlWriter.php.

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

370  : void
371  {
372  // open file
373  if (!($fp = fopen($file, "w+"))) {
374  throw new RuntimeException(
375  "<b>Error</b>: Could not open \"" . $file . "\" for writing" .
376  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"
377  );
378  }
379 
380  // set file permissions
381  chmod($file, 0770);
382 
383  // format xml data
384  if ($format) {
385  $xmlStr = $this->xmlFormatData($this->xmlStr);
386  } else {
388  }
389 
390  // write xml data into the file
391  fwrite($fp, $xmlStr);
392 
393  // close file
394  fclose($fp);
395  }
xmlFormatData(string $data)
Indents text for better reading.
$format
Definition: metadata.php:235
+ Here is the call graph for this function:

◆ xmlDumpMem()

ilXmlWriter::xmlDumpMem ( bool  $format = true)

Returns xml document from memory.

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

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

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

400  : string
401  {
402  // format xml data
403  if ($format) {
404  $xmlStr = $this->xmlFormatData($this->xmlStr);
405  } else {
407  }
408 
409  return $xmlStr;
410  }
xmlFormatData(string $data)
Indents text for better reading.
$format
Definition: metadata.php:235
+ 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 342 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(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\addPropertiesToXML(), assQuestion\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), assQuestionExport\addSolutionHints(), 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(), ilStructureObject\exportFO(), ilLMPageObject\exportFO(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilSoapStructureObject\exportXML(), ilGlossaryTerm\exportXML(), ilLMPageObject\exportXML(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ilTestExportRandomQuestionSet\populateCommonSettings(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapRoleObjectXMLWriter\start(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateIncludeFilterPattern\toXml(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilWebLinkItem\toXML(), ilMDFormat\toXML(), ilWebLinkParameter\toXML(), ilMDEntity\toXML(), ilMDIdentifier\toXML(), ilMDIdentifier_\toXML(), ilMDLocation\toXML(), ilMDKeyword\toXML(), ilDidacticTemplateIconHandler\toXml(), ilMDDescription\toXML(), ilMDLanguage\toXML(), ilMDTaxon\toXML(), ilMDAnnotation\toXML(), ilMDTypicalAgeRange\toXML(), ilMDTaxonPath\toXML(), ilObjLinkResource\toXML(), ilMDContribute\toXML(), ilMDLifecycle\toXML(), ilMDRights\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilAdvancedMDRecordTranslations\toXML(), ilLOTestAssignments\toXml(), ilMultilingualism\toXml(), ilLORandomTestQuestionPools\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilCourseObjectiveMaterials\toXml(), ilMDEducational\toXML(), ilDidacticTemplateSetting\toXml(), ilLOSettings\toXml(), ilCourseObjective\toXml(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilFolderXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeDescription(), ilLearningSequenceXMLWriter\writeLPSettings(), ilLearningSequenceXMLWriter\writeLSItems(), ilLearningSequenceXMLWriter\writeOwner(), ilRoleXmlExport\writeRole(), ilLearningSequenceXMLWriter\writeSettings(), and ilLearningSequenceXMLWriter\writeTitle().

348  : void {
349  // check for existing data (element's content)
350  if (is_string($data) or
351  is_integer($data) or
352  is_float($data)) {
353  // write starttag
354  $this->xmlStartTag($tag, $attrs, false, $encode, $escape);
355 
356  // write text
357  $this->xmlData($data, $encode, $escape);
358 
359  // write endtag
360  $this->xmlEndTag($tag);
361  } else { // no data
362  // write starttag (= empty tag)
363  $this->xmlStartTag($tag, $attrs, true, $encode, $escape);
364  }
365  }
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 134 of file class.ilXmlWriter.php.

References $data.

Referenced by xmlData(), and xmlStartTag().

134  : string
135  {
136  if ($this->inEnc == $this->outEnc) {
137  $encodedData = $data;
138  } else {
139  switch (strtolower($this->outEnc)) {
140  case "utf-8":
141  if (strtolower($this->inEnc) == "iso-8859-1") {
142  $encodedData = utf8_encode($data);
143  } else {
144  die(
145  "<b>Error</b>: Cannot encode iso-8859-1 data in " . $this->outEnc .
146  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"
147  );
148  }
149  break;
150 
151  case "iso-8859-1":
152  if (strtolower($this->inEnc) == "utf-8") {
153  $encodedData = utf8_decode($data);
154  } else {
155  die(
156  "<b>Error</b>: Cannot encode utf-8 data in " . $this->outEnc .
157  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"
158  );
159  }
160  break;
161 
162  default:
163  die(
164  "<b>Error</b>: Cannot encode " . $this->inEnc . " data in " . $this->outEnc .
165  " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />"
166  );
167  }
168  }
169  return $encodedData;
170  }
+ Here is the caller graph for this function:

◆ xmlEndTag()

ilXmlWriter::xmlEndTag ( string  $tag)

Writes an endtag.

Definition at line 305 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(), assQuestion\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), 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(), ilGlossaryDefinition\exportXML(), ilGlossaryTerm\exportXML(), ilLMPageObject\exportXML(), ilObjGlossary\exportXML(), ilObjContentObject\exportXML(), ilObjGlossary\exportXMLGlossaryItems(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapRoleObjectXMLWriter\start(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilWebLinkItem\toXML(), ilMDOrComposite\toXML(), ilDidacticTemplateLocalRoleAction\toXml(), ilMDAnnotation\toXML(), ilMDTaxonPath\toXML(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilMDContribute\toXML(), ilMDLifecycle\toXML(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMDRelation\toXML(), ilMDRights\toXML(), ilMDMetaMetadata\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilMD\toXML(), ilAdvancedMDRecordTranslations\toXML(), ilMultilingualism\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilMDEducational\toXML(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilFolderXmlWriter\write(), ilContainerXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeFooter(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

305  : void
306  {
307  $this->xmlStr .= "</" . $tag . ">";
308  }
+ Here is the caller graph for this function:

◆ xmlEscapeData()

ilXmlWriter::xmlEscapeData ( string  $data)
private

Escapes reserved characters.

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

Referenced by xmlData(), and xmlStartTag().

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

◆ xmlFormatData()

ilXmlWriter::xmlFormatData ( string  $data)

Indents text for better reading.

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

Referenced by xmlDumpFile(), and xmlDumpMem().

175  : ?string
176  {
177  // regular expression for tags
178  $formatedXml = preg_replace_callback(
179  "|<[^>]*>[^<]*|",
180  [$this, "xmlFormatElement"],
181  $data
182  );
183 
184  return $formatedXml;
185  }
+ 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 190 of file class.ilXmlWriter.php.

190  : string
191  {
192  $found = trim($array[0]);
193 
194  static $indent;
195 
196  // linebreak (default)
197  $nl = "\n";
198 
199  $tab = str_repeat(" ", $indent * 2);
200 
201  // closing tag
202  if (substr($found, 0, 2) == "</") {
203  if ($indent) {
204  $indent--;
205  }
206  $tab = str_repeat(" ", $indent * 2);
207  } elseif (substr(
208  $found,
209  -2,
210  1
211  ) == "/" or // opening and closing, comment, ...
212  strpos($found, "/>") or
213  substr($found, 0, 2) == "<!") {
214  // do not change indent
215  } elseif (substr($found, 0, 2) == "<?") {
216  // do not change indent
217  // no linebreak
218  $nl = "";
219  } else { // opening tag
220  $indent++;
221  }
222 
223  // content
224  if (substr($found, -1) != ">") {
225  $found = str_replace(
226  ">",
227  ">\n" . str_repeat(" ", ($indent + 0) * 2),
228  $found
229  );
230  }
231 
232  return $nl . $tab . $found;
233  }

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header.

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

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

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

238  : void
239  {
240  // version and encoding
241  $this->xmlStr .= "<?xml version=\"" . $this->version . "\" encoding=\"" . $this->outEnc . "\"?>";
242 
243  // dtd definition
244  if ($this->dtdDef <> "") {
245  $this->xmlStr .= $this->dtdDef;
246  }
247 
248  // stSheet
249  if ($this->stSheet <> "") {
250  $this->xmlStr .= $this->stSheet;
251  }
252 
253  // generated comment
254  if ($this->genCmt <> "") {
255  $this->xmlComment($this->genCmt);
256  }
257  }
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 71 of file class.ilXmlWriter.php.

References $stSheet.

71  : void
72  {
73  $this->stSheet = $stSheet;
74  }

◆ xmlStartTag()

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

Writes a starttag.

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

References $name, 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(), assQuestion\addQTIMaterial(), assQuestionExport\addQtiMetaDataField(), ilDataSet\addRecordsXml(), 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(), ilGlossaryDefinition\exportXML(), ilGlossaryTerm\exportXML(), ilLMPageObject\exportXML(), ilObjGlossary\exportXML(), ilObjContentObject\exportXML(), ilObjGlossary\exportXMLGlossaryItems(), ilObjContentObject\exportXMLProperties(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), SurveyTextQuestion\insertXML(), SurveyMultipleChoiceQuestion\insertXML(), SurveyMetricQuestion\insertXML(), SurveySingleChoiceQuestion\insertXML(), SurveyMatrixQuestion\insertXML(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapInstallationInfoXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilWebLinkItem\toXML(), ilMDOrComposite\toXML(), ilDidacticTemplateLocalRoleAction\toXml(), ilMDAnnotation\toXML(), ilMDTaxonPath\toXML(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilMDContribute\toXML(), ilMDLifecycle\toXML(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMDRelation\toXML(), ilMDRights\toXML(), ilMDMetaMetadata\toXML(), ilMDClassification\toXML(), ilMDRequirement\toXML(), ilMD\toXML(), ilAdvancedMDRecordTranslations\toXML(), ilMultilingualism\toXml(), ilMDTechnical\toXML(), ilMDGeneral\toXML(), ilMDEducational\toXML(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilFolderXmlWriter\write(), ilContainerXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeLearningSequence(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

268  : void {
269  // write first part of the starttag
270  $this->xmlStr .= "<" . $tag;
271 
272  // check for existing attributes
273  if (is_array($attrs)) {
274  // write attributes
275  foreach ($attrs as $name => $value) {
276  if ($value === null) {
277  $value = '';
278  }
279 
280  // encode
281  if ($encode) {
282  $value = $this->xmlEncodeData($value);
283  }
284 
285  // escape
286  if ($escape) {
287  $value = $this->xmlEscapeData($value);
288  }
289 
290  $this->xmlStr .= " " . $name . "=\"" . $value . "\"";
291  }
292  }
293 
294  // write last part of the starttag
295  if ($empty) {
296  $this->xmlStr .= "/>";
297  } else {
298  $this->xmlStr .= ">";
299  }
300  }
xmlEscapeData(string $data)
Escapes reserved characters.
if($format !==null) $name
Definition: metadata.php:247
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 40 of file class.ilXmlWriter.php.

Referenced by xmlHeader(), and xmlSetDtdDef().

◆ $genCmt

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

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

Referenced by xmlSetGenCmt().

◆ $inEnc

string ilXmlWriter::$inEnc
private

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

Referenced by __construct().

◆ $outEnc

string ilXmlWriter::$outEnc
private

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

Referenced by __construct().

◆ $stSheet

string ilXmlWriter::$stSheet = ""
private

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

Referenced by xmlHeader(), and xmlSetStSheet().

◆ $version

string ilXmlWriter::$version
private

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

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

◆ $xmlStr

string ilXmlWriter::$xmlStr
private

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

Referenced by xmlDumpFile(), and xmlDumpMem().


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