ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 26 of file class.ilXMLResultSetWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilXMLResultSetWriter::__construct ( ilXMLResultSet  $xmlResultSet)

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

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

31  {
33  $this->xmlResultSet = $xmlResultSet;
34  }
__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 72 of file class.ilXMLResultSetWriter.php.

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

Referenced by buildRows().

72  : void
73  {
74  $this->xmlStartTag('row', null);
75  foreach ($xmlResultSetRow->getColumns() as $value) {
76  $this->xmlElement('column', null, $value);
77  }
78  $this->xmlEndTag('row');
79  }
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 52 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

52  : void
53  {
54  $this->xmlStartTag("colspecs");
55  foreach ($this->xmlResultSet->getColSpecs() as $colSpec) {
56  $attr = array("idx" => $colSpec->getIndex(), "name" => $colSpec->getName());
57 
58  $this->xmlElement("colspec", $attr, null);
59  }
60  $this->xmlEndTag("colspecs");
61  }
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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 81 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlEndTag().

Referenced by start().

81  : void
82  {
83  $this->xmlEndTag('result');
84  }
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 45 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

45  : void
46  {
47  $this->xmlSetDtdDef("<!DOCTYPE result PUBLIC \"-//ILIAS//DTD XMLResultSet//EN\" \"" . ILIAS_HTTP_PATH . "/components/ILIAS/Export/xml/ilias_xml_resultset_3_7.dtd\">");
48  $this->xmlHeader();
49  $this->xmlStartTag("result");
50  }
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 63 of file class.ilXMLResultSetWriter.php.

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

Referenced by start().

63  : void
64  {
65  $this->xmlStartTag("rows");
66  foreach ($this->xmlResultSet->getRows() as $row) {
67  $this->appendRow($row);
68  }
69  $this->xmlEndTag("rows");
70  }
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 86 of file class.ilXMLResultSetWriter.php.

References ilXmlWriter\xmlDumpMem().

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

◆ start()

ilXMLResultSetWriter::start ( )

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

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

36  : bool
37  {
38  $this->buildHeader();
39  $this->buildColSpecs();
40  $this->buildRows();
41  $this->buildFooter();
42  return true;
43  }
+ Here is the call graph for this function:

Field Documentation

◆ $xmlResultSet

ilXMLResultSet ilXMLResultSetWriter::$xmlResultSet
protected

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

Referenced by __construct().


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