ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 12 of file class.ilXMLResultSetWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilXMLResultSetWriter::__construct ( ilXMLResultSet  $xmlResultSet)

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

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

17  {
19  $this->xmlResultSet = $xmlResultSet;
20  }
__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 58 of file class.ilXMLResultSetWriter.php.

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

Referenced by buildRows().

58  : void
59  {
60  $this->xmlStartTag('row', null);
61  foreach ($xmlResultSetRow->getColumns() as $value) {
62  $this->xmlElement('column', null, $value);
63  }
64  $this->xmlEndTag('row');
65  }
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 38 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

38  : void
39  {
40  $this->xmlStartTag("colspecs");
41  foreach ($this->xmlResultSet->getColSpecs() as $colSpec) {
42  $attr = array("idx" => $colSpec->getIndex(), "name" => $colSpec->getName());
43 
44  $this->xmlElement("colspec", $attr, null);
45  }
46  $this->xmlEndTag("colspecs");
47  }
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 67 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

67  : void
68  {
69  $this->xmlEndTag('result');
70  }
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 31 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

31  : void
32  {
33  $this->xmlSetDtdDef("<!DOCTYPE result PUBLIC \"-//ILIAS//DTD XMLResultSet//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_xml_resultset_3_7.dtd\">");
34  $this->xmlHeader();
35  $this->xmlStartTag("result");
36  }
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 49 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

49  : void
50  {
51  $this->xmlStartTag("rows");
52  foreach ($this->xmlResultSet->getRows() as $row) {
53  $this->appendRow($row);
54  }
55  $this->xmlEndTag("rows");
56  }
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 72 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlDumpMem().

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

◆ start()

ilXMLResultSetWriter::start ( )

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

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

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

Field Documentation

◆ $xmlResultSet

ilXMLResultSet ilXMLResultSetWriter::$xmlResultSet
protected

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

Referenced by __construct().


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