ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

31 {
33 $this->xmlResultSet = $xmlResultSet;
34 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

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

+ 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.

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 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

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

Referenced by buildRows().

+ 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.

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 }

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

Referenced by start().

+ 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.

81 : void
82 {
83 $this->xmlEndTag('result');
84 }

References ilXmlWriter\xmlEndTag().

Referenced by start().

+ 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.

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 }
xmlHeader()
Writes xml header.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.

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

Referenced by start().

+ 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.

63 : void
64 {
65 $this->xmlStartTag("rows");
66 foreach ($this->xmlResultSet->getRows() as $row) {
67 $this->appendRow($row);
68 }
69 $this->xmlEndTag("rows");
70 }
appendRow(ilXMLResultSetRow $xmlResultSetRow)

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

Referenced by start().

+ 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.

86 : string
87 {
88 return $this->xmlDumpMem(false);
89 }
xmlDumpMem(bool $format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ 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().

+ 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: