ILIAS  release_8 Revision v8.23
ilXMLResultSetWriter Class Reference

XML Writer for XMLResultSet. More...

+ Inheritance diagram for ilXMLResultSetWriter:
+ Collaboration diagram for ilXMLResultSetWriter:

Public Member Functions

 __construct (ilXMLResultSet $xmlResultSet)
 
 start ()
 
 getXML ()
 
- Public Member Functions inherited from ilXmlWriter
 __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...
 

Protected Attributes

ilXMLResultSet $xmlResultSet
 

Private Member Functions

 buildHeader ()
 
 buildColSpecs ()
 
 buildRows ()
 
 appendRow (ilXMLResultSetRow $xmlResultSetRow)
 
 buildFooter ()
 

Detailed Description

XML Writer for XMLResultSet.

Author
Roland Kuestermann (rku@a.nosp@m.ifb..nosp@m.uni-k.nosp@m.arls.nosp@m.ruhe..nosp@m.de)
Todo:
remove dependency to ilXmlWriter and use SimpleXML

Definition at line 10 of file class.ilXMLResultSetWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilXMLResultSetWriter::__construct ( ilXMLResultSet  $xmlResultSet)

Definition at line 14 of file class.ilXMLResultSetWriter.php.

References $xmlResultSet, and ILIAS\GlobalScreen\Provider\__construct().

15  {
17  $this->xmlResultSet = $xmlResultSet;
18  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ appendRow()

ilXMLResultSetWriter::appendRow ( ilXMLResultSetRow  $xmlResultSetRow)
private

Definition at line 56 of file class.ilXMLResultSetWriter.php.

References ilXMLResultSetRow\getColumns(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by buildRows().

56  : void
57  {
58  $this->xmlStartTag('row', null);
59  foreach ($xmlResultSetRow->getColumns() as $value) {
60  $this->xmlElement('column', null, $value);
61  }
62  $this->xmlEndTag('row');
63  }
xmlEndTag(string $tag)
Writes an endtag.
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildColSpecs()

ilXMLResultSetWriter::buildColSpecs ( )
private

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

References ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

36  : void
37  {
38  $this->xmlStartTag("colspecs");
39  foreach ($this->xmlResultSet->getColSpecs() as $colSpec) {
40  $attr = array("idx" => $colSpec->getIndex(), "name" => $colSpec->getName());
41 
42  $this->xmlElement("colspec", $attr, null);
43  }
44  $this->xmlEndTag("colspecs");
45  }
xmlEndTag(string $tag)
Writes an endtag.
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)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildFooter()

ilXMLResultSetWriter::buildFooter ( )
private

Definition at line 65 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

65  : void
66  {
67  $this->xmlEndTag('result');
68  }
xmlEndTag(string $tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilXMLResultSetWriter::buildHeader ( )
private

Definition at line 29 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlHeader(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlStartTag().

Referenced by start().

29  : void
30  {
31  $this->xmlSetDtdDef("<!DOCTYPE result PUBLIC \"-//ILIAS//DTD XMLResultSet//EN\" \"" . ILIAS_HTTP_PATH . "/xml/ilias_xml_resultset_3_7.dtd\">");
32  $this->xmlHeader();
33  $this->xmlStartTag("result");
34  }
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header.
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:

◆ buildRows()

ilXMLResultSetWriter::buildRows ( )
private

Definition at line 47 of file class.ilXMLResultSetWriter.php.

References appendRow(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

47  : void
48  {
49  $this->xmlStartTag("rows");
50  foreach ($this->xmlResultSet->getRows() as $row) {
51  $this->appendRow($row);
52  }
53  $this->xmlEndTag("rows");
54  }
xmlEndTag(string $tag)
Writes an endtag.
appendRow(ilXMLResultSetRow $xmlResultSetRow)
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:

◆ getXML()

ilXMLResultSetWriter::getXML ( )

Definition at line 70 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlDumpMem().

70  : string
71  {
72  return $this->xmlDumpMem(false);
73  }
xmlDumpMem(bool $format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ start()

ilXMLResultSetWriter::start ( )

Definition at line 20 of file class.ilXMLResultSetWriter.php.

References buildColSpecs(), buildFooter(), buildHeader(), and buildRows().

20  : bool
21  {
22  $this->buildHeader();
23  $this->buildColSpecs();
24  $this->buildRows();
25  $this->buildFooter();
26  return true;
27  }
+ Here is the call graph for this function:

Field Documentation

◆ $xmlResultSet

ilXMLResultSet ilXMLResultSetWriter::$xmlResultSet
protected

Definition at line 12 of file class.ilXMLResultSetWriter.php.

Referenced by __construct().


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