ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Sabre\Xml\Element\Eater Class Reference

The intention for this reader class, is to read past the end element. More...

+ Inheritance diagram for Sabre\Xml\Element\Eater:
+ Collaboration diagram for Sabre\Xml\Element\Eater:

Public Member Functions

 xmlSerialize (Xml\Writer $writer)
 The serialize method is called during xml writing. More...
 
- Public Member Functions inherited from Sabre\Xml\XmlSerializable
 xmlSerialize (Writer $writer)
 The xmlSerialize method is called during xml writing. More...
 

Static Public Member Functions

static xmlDeserialize (Xml\Reader $reader)
 The deserialize method is called during xml parsing. More...
 
- Static Public Member Functions inherited from Sabre\Xml\XmlDeserializable
static xmlDeserialize (Reader $reader)
 The deserialize method is called during xml parsing. More...
 

Detailed Description

The intention for this reader class, is to read past the end element.

This should trigger a ParseException

Author
Evert Pot (http://evertpot.com/) http://sabre.io/license/ Modified BSD License

Definition at line 15 of file Eater.php.

Member Function Documentation

◆ xmlDeserialize()

static Sabre\Xml\Element\Eater::xmlDeserialize ( Xml\Reader  $reader)
static

The deserialize method is called during xml parsing.

This method is called statictly, this is because in theory this method may be used as a type of constructor, or factory method.

Often you want to return an instance of the current class, but you are free to return other data as well.

Important note 2: You are responsible for advancing the reader to the next element. Not doing anything will result in a never-ending loop.

If you just want to skip parsing for this element altogether, you can just call $reader->next();

$reader->parseSubTree() will parse the entire sub-tree, and advance to the next element.

Parameters
Xml\Reader$reader
Returns
mixed

Definition at line 61 of file Eater.php.

61  {
62 
63  $reader->next();
64 
65  $count = 1;
66  while ($count) {
67 
68  $reader->read();
69  if ($reader->nodeType === $reader::END_ELEMENT) {
70  $count--;
71  }
72 
73  }
74  $reader->read();
75 
76  }

◆ xmlSerialize()

Sabre\Xml\Element\Eater::xmlSerialize ( Xml\Writer  $writer)

The serialize method is called during xml writing.

It should use the $writer argument to encode this object into Xml.

Important note: it is not needed to create the parent element. The parent element is already created, and we only have to worry about attributes, child elements and text (if any).

Important note 2: If you are writing any new elements, you are also responsible for closing them.

Parameters
Xml\Writer$writer
Returns
void

Definition at line 32 of file Eater.php.

32  {
33 
34  $writer->startElement('{http://sabredav.org/ns}elem1');
35  $writer->write('hiiii!');
36  $writer->endElement();
37 
38  }

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