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 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 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 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 public

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

References $inEnc, $outEnc, and $version.

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  }

Member Function Documentation

◆ _ilXmlWriter()

ilXmlWriter::_ilXmlWriter ( )

destructor 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 static

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

References $code, and $data.

Referenced by xmlData(), and xmlStartTag().

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
+ 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.

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

462  {
463  $this->xmlStr .= $a_str;
464  }
+ Here is the caller graph for this function:

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr public

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

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

471  {
472  // reset xml string
473  $this->xmlStr = "";
474  }
+ Here is the caller graph for this function:

◆ xmlComment()

ilXmlWriter::xmlComment (   $comment)

Writes a comment.

Parameters
stringcomment public

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

References $comment.

Referenced by xmlHeader().

354  {
355  $this->xmlStr .= "<!--" . $comment . "-->";
356  }
$comment
Definition: buildRTE.php:83
+ 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) public

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

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

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

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.
$data
Definition: bench.php:6
+ 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) public

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

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

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  }
$format
Definition: metadata.php:141
xmlFormatData($data)
Indents text for better reading.
+ 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 public

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

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

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

447  {
448  // format xml data
449  if ($format) {
450  $xmlStr = $this->xmlFormatData($this->xmlStr);
451  } else {
453  }
454 
455  return $xmlStr;
456  }
$format
Definition: metadata.php:141
xmlFormatData($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 (   $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) public

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

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(), ilContainerSortingSettings\_exportContainerSortingSettings(), ilLPXmlWriter\addLPInformation(), ilAdvancedMDFieldDefinitionFloat\addPropertiesToXML(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\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(), ilObjectXMLWriter\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilTestExportRandomQuestionSet\populateCommonSettings(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilDidacticTemplateIncludeFilterPattern\toXml(), ilObjLinkResource\toXML(), ilLOTestAssignments\toXml(), ilMultilingualism\toXml(), ilLORandomTestQuestionPools\toXml(), ilCourseObjectiveMaterials\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLOSettings\toXml(), ilLinkResourceItems\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().

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  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlData($data, $encode=true, $escape=true)
Writes data.
xmlEndTag($tag)
Writes an endtag.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
$data
Definition: bench.php:6
+ 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 private

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

References $data.

Referenced by xmlData(), and xmlStartTag().

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  }
$data
Definition: bench.php:6
+ Here is the caller graph for this function:

◆ xmlEndTag()

ilXmlWriter::xmlEndTag (   $tag)

Writes an endtag.

Parameters
stringtag name public

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

References $tag.

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilCourseXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilSoapInstallationInfoXMLWriter\__buildFooter(), ilXMLResultSetWriter\__buildFooter(), ilUserXMLWriter\__buildFooter(), ilSoapRoleObjectXMLWriter\__buildFooter(), ilGroupXMLWriter\__buildFooter(), ilCourseXMLWriter\__buildFooter(), ilObjectXMLWriter\__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(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateLocalRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMultilingualism\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLinkResourceItems\toXML(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\write(), ilFolderXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeFooter(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

344  {
345  $this->xmlStr .= "</" . $tag . ">";
346  }
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ Here is the caller graph for this function:

◆ xmlFormatData()

ilXmlWriter::xmlFormatData (   $data)

Indents text for better reading.

Parameters
stringinput text
Returns
string indented text private

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

References $data.

Referenced by xmlDumpFile(), and xmlDumpMem().

221  {
222  // regular expression for tags
223  $formatedXml = preg_replace_callback("|<[^>]*>[^<]*|", array($this, "xmlFormatElement"), $data);
224 
225  return $formatedXml;
226  }
$data
Definition: bench.php:6
+ 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 private

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

References $tab.

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  }

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header public.

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

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

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

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.
+ 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 public

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

References $stSheet.

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

◆ 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) public

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

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

Referenced by ilObjectXMLWriter\__appendObjectProperties(), ilXMLResultSetWriter\__appendRow(), ilObjectXMLWriter\__appendTimeTargets(), ilCourseXMLWriter\__buildAdmin(), ilSoapInstallationInfoXMLWriter\__buildClient(), ilXMLResultSetWriter\__buildColSpecs(), ilCourseXMLWriter\__buildCourseStart(), ilGroupXMLWriter\__buildGroup(), ilSoapInstallationInfoXMLWriter\__buildHeader(), ilXMLResultSetWriter\__buildHeader(), ilUserXMLWriter\__buildHeader(), ilSoapRoleObjectXMLWriter\__buildHeader(), ilObjectXMLWriter\__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(), ilSCORM2004Asset\exportPDF(), ilObjSCORM2004LearningModule\exportPDF(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilObjectXMLWriter\getXML(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapInstallationInfoXMLWriter\start(), ilChatroomXMLWriter\start(), ilForumXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateLocalRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMultilingualism\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLinkResourceItems\toXML(), ilAdvancedMDRecord\toXML(), ilCourseObjectiveQuestion\toXml(), ilAdvancedMDFieldDefinition\toXML(), ilDidacticTemplateXmlWriter\write(), ilContainerXmlWriter\write(), ilFolderXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilLearningSequenceXMLWriter\writeLearningSequence(), ilLearningSequenceXMLWriter\writeLSItems(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

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  }
static _xmlEscapeData($data)
Escapes reserved characters.
xmlEncodeData($data)
Encodes text from input encoding into output encoding.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
+ 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: