46     private string $genCmt = 
"Generated by ILIAS XmlWriter";
    49         string $version = 
"1.0",
    50         string $outEnc = 
"utf-8",
    51         string $inEnc = 
"utf-8"    92         $length = strlen($data);
    95         for (; $position < $length;) {
    96             $character = substr($data, $position, 1);
    97             $code = Ord($character);
   101                     $character = 
""";
   105                     $character = 
"&";
   109                     $character = 
"'";
   122                         $character = (
"&#" . $code . 
";");
   127             $escapedData .= $character;
   138         if ($this->inEnc == $this->outEnc) {
   139             $encodedData = 
$data;
   142                 'Differing in and out-encodings are not supported.'   154         $formatedXml = preg_replace_callback(
   156             [$this, 
"xmlFormatElement"],
   168         $found = trim($array[0]);
   175         $tab = str_repeat(
" ", $indent * 2);
   178         if (substr($found, 0, 2) == 
"</") {
   182             $tab = str_repeat(
" ", $indent * 2);
   188             strpos($found, 
"/>") or
   189             substr($found, 0, 2) == 
"<!") {
   191         } elseif (substr($found, 0, 2) == 
"<?") {
   200         if (substr($found, -1) != 
">") {
   201             $found = str_replace(
   203                 ">\n" . str_repeat(
" ", ($indent + 0) * 2),
   208         return $nl . $tab . $found;
   217         $this->xmlStr .= 
"<?xml version=\"" . $this->version . 
"\" encoding=\"" . $this->outEnc . 
"\"?>";
   220         if ($this->dtdDef <> 
"") {
   225         if ($this->stSheet <> 
"") {
   230         if ($this->genCmt <> 
"") {
   240         ?array $attrs = null,
   246         $this->xmlStr .= 
"<" . $tag;
   249         if (is_array($attrs)) {
   251             foreach ($attrs as $name => $value) {
   252                 if ($value === null) {
   266                 $this->xmlStr .= 
" " . $name . 
"=\"" . $value . 
"\"";
   272             $this->xmlStr .= 
"/>";
   274             $this->xmlStr .= 
">";
   283         $this->xmlStr .= 
"</" . $tag . 
">";
   291         $this->xmlStr .= 
"<!--" . $comment . 
"-->";
   312         $this->xmlStr .= 
$data;
   326         if (is_string(
$data) or
   330             $this->
xmlStartTag($tag, $attrs, 
false, $encode, $escape);
   339             $this->
xmlStartTag($tag, $attrs, 
true, $encode, $escape);
   346     public function xmlDumpFile(
string $file, 
bool $format = 
true): void
   349         if (!($fp = fopen($file, 
"w+"))) {
   351                 "<b>Error</b>: Could not open \"" . $file . 
"\" for writing" .
   352                 " in <b>" . __FILE__ . 
"</b> on line <b>" . __LINE__ . 
"</b><br />"   367         fwrite($fp, $xmlStr);
   393         $this->xmlStr .= $a_str;
 
xmlData(string $data, bool $encode=true, bool $escape=true)
Writes data. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
xmlEscapeData(string $data)
Escapes reserved characters. 
 
xmlComment(string $comment)
Writes a comment. 
 
xmlSetGenCmt(string $genCmt)
Sets generated comment. 
 
appendXML(string $a_str)
append xml string to document 
 
xmlDumpFile(string $file, bool $format=true)
Dumps xml document from memory into a file. 
 
xmlEndTag(string $tag)
Writes an endtag. 
 
xmlEncodeData(string $data)
Encodes text from input encoding into output encoding. 
 
xmlSetDtdDef(string $dtdDef)
Sets dtd definition. 
 
xmlFormatData(string $data)
Indents text for better reading. 
 
xmlHeader()
Writes xml header. 
 
xmlFormatElement(array $array)
Callback function for xmlFormatData; do not invoke directly. 
 
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag. 
 
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content) 
 
__construct(string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
xmlDumpMem(bool $format=true)
Returns xml document from memory. 
 
xmlSetStSheet(string $stSheet)
Sets stylesheet.