ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
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  }
$code
Definition: example_050.php:99
+ 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.

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

506  {
507  $this->xmlStr .= $a_str;
508  }
+ Here is the caller graph for this function:

◆ xmlClear()

ilXmlWriter::xmlClear ( )

clears xmlStr public

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

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

515  {
516  // reset xml string
517  $this->xmlStr = "";
518  }
+ Here is the caller graph for this function:

◆ xmlComment()

ilXmlWriter::xmlComment (   $comment)

Writes a comment.

Parameters
stringcomment public

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

Referenced by xmlHeader().

386  {
387  $this->xmlStr .= "<!--".$comment."-->";
388  }
+ 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 397 of file class.ilXmlWriter.php.

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

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

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  }
static _xmlEscapeData($data)
Escapes reserved characters.
xmlEncodeData($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 (   $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 452 of file class.ilXmlWriter.php.

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

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  }
xmlFormatData($data)
Indents text for better reading.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ 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 487 of file class.ilXmlWriter.php.

References $xmlStr, and xmlFormatData().

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

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

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(), ilAdvancedMDFieldDefinitionText\addPropertiesToXML(), ilAdvancedMDFieldDefinitionInteger\addPropertiesToXML(), ilAdvancedMDFieldDefinitionSelect\addPropertiesToXML(), assQuestionExport\addQtiMetaDataField(), ilSoapLearningProgressAdministration\addUserProgress(), ilExerciseXMLWriter\attachMarking(), ilContainerReferenceXmlWriter\buildTarget(), ilContainerReferenceXmlWriter\buildTitle(), ilCategoryXmlWriter\buildTranslations(), ilTestResultsToXML\exportActiveIDs(), ilTestResultsToXML\exportPassResult(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilTestExportRandomQuestionSet\populateCommonSettings(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapRoleObjectXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateExcludeFilterPattern\toXml(), ilDidacticTemplateIncludeFilterPattern\toXml(), ilObjLinkResource\toXML(), ilLORandomTestQuestionPools\toXml(), ilLOTestAssignments\toXml(), ilMultilingualism\toXml(), ilCourseObjectiveMaterials\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLOSettings\toXml(), ilLinkResourceItems\toXML(), ilAdvancedMDRecord\toXML(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjectiveQuestion\toXml(), ilFolderXmlWriter\write(), ilContainerXmlWriter\writeCourseItemInformation(), and ilRoleXmlExport\writeRole().

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  }
xmlData($data, $encode=TRUE, $escape=TRUE)
Writes data.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
+ 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 185 of file class.ilXmlWriter.php.

References $data.

Referenced by xmlData(), and xmlStartTag().

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  }
+ Here is the caller graph for this function:

◆ xmlEndTag()

ilXmlWriter::xmlEndTag (   $tag)

Writes an endtag.

Parameters
stringtag name public

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

Referenced by ilObjectXMLWriter\__appendObject(), 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\__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\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapRoleObjectXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateLocalRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMultilingualism\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLinkResourceItems\toXML(), ilAdvancedMDRecord\toXML(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjectiveQuestion\toXml(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilFolderXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

376  {
377  $this->xmlStr .= "</".$tag.">";
378  }
+ 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 233 of file class.ilXmlWriter.php.

References $data, and array.

Referenced by xmlDumpFile(), and xmlDumpMem().

234  {
235  // regular expression for tags
236  $formatedXml = preg_replace_callback("|<[^>]*>[^<]*|", array($this, "xmlFormatElement"), $data);
237 
238  return $formatedXml;
239  }
Create styles array
The data for the language used.
+ 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 247 of file class.ilXmlWriter.php.

References $tab.

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  }

◆ xmlHeader()

ilXmlWriter::xmlHeader ( )

Writes xml header public.

Definition at line 297 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(), ilContObjectManifestBuilder\buildManifest(), ilTestResultsToXML\getXML(), assLongMenuExport\toXML(), assKprimChoiceExport\toXML(), assErrorTextExport\toXML(), assOrderingHorizontalExport\toXML(), assFileUploadExport\toXML(), assFlashQuestionExport\toXML(), assSingleChoiceExport\toXML(), assNumericExport\toXML(), assTextSubsetExport\toXML(), assTextQuestionExport\toXML(), assClozeTestExport\toXML(), assFormulaQuestionExport\toXML(), assImagemapQuestionExport\toXML(), assMultipleChoiceExport\toXML(), assJavaAppletExport\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().

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

References _xmlEscapeData(), and xmlEncodeData().

Referenced by ilObjectXMLWriter\__appendObject(), 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\__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(), ilSCORM2004Asset\exportPDF(), ilObjSCORM2004LearningModule\exportPDF(), ilTestResultsToXML\exportRandomTestQuestions(), ilTestResultsToXML\exportResultCache(), ilTestResultsToXML\exportTestResults(), ilTestResultsToXML\exportTestSequence(), ilTestResultsToXML\exportTestSolutions(), ilTestResultsToXML\exportTestTimes(), ilTestResultsToXML\getXML(), ilAdvancedMetaDataExporter\getXmlRepresentation(), ilExerciseXMLWriter\handleAssignmentFiles(), ilExerciseXMLWriter\handleAssignmentMembers(), ilObjQuestionPool\objectToXmlWriter(), ilTestExportRandomQuestionSet\populateQuestionSetConfigXml(), ilTestExportRandomQuestionSet\populateQuestionStages(), ilTestExportRandomQuestionSet\populateSelectionDefinitions(), ilSoapInstallationInfoXMLWriter\start(), ilSoapRoleObjectXMLWriter\start(), ilForumXMLWriter\start(), ilExerciseXMLWriter\start(), ilFileXMLWriter\start(), ilDidacticTemplateLocalRoleAction\toXml(), ilObjLinkResource\toXML(), ilDidacticTemplateBlockRoleAction\toXml(), ilDidacticTemplateLocalPolicyAction\toXml(), ilMultilingualism\toXml(), ilDidacticTemplateSetting\toXml(), ilCourseObjective\toXml(), ilLinkResourceItems\toXML(), ilAdvancedMDRecord\toXML(), ilAdvancedMDFieldDefinition\toXML(), ilCourseObjectiveQuestion\toXml(), ilContainerXmlWriter\write(), ilDidacticTemplateXmlWriter\write(), ilFolderXmlWriter\write(), ilAdvancedMDRecordXMLWriter\write(), ilRoleXmlExport\write(), ilContainerXmlWriter\writeCourseItemInformation(), ilRoleXmlExport\writeRole(), ilContainerXmlWriter\writeSubitems(), and xmlElement().

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

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: