12 namespace fpoirotte\XRL;
44 public function __construct(\XMLReader $reader, $validate, $subtrees)
50 if (($subtrees && !@$reader->read()) ||
51 (!$subtrees && !@$reader->next())) {
52 $error = libxml_get_last_error();
59 throw new \InvalidArgumentException(
'End of document');
62 if ($error->code === 32) {
64 throw \fpoirotte\XRL\Faults::get(
67 } elseif ($error->code === 1 || $error->code === 2) {
70 throw \fpoirotte\XRL\Faults::get(
75 throw \fpoirotte\XRL\Faults::get(
80 if ($validate && !$reader->isValid()) {
81 throw \fpoirotte\XRL\Faults::get(
87 }
while ($reader->nodeType === \XMLReader::SIGNIFICANT_WHITESPACE);
97 $this->properties = array();
98 foreach ($fields as $field) {
99 $this->properties[$field] = $reader->$field;
101 $name = $reader->localName;
102 if ($reader->namespaceURI !==
'') {
103 $name =
'{' . $reader->namespaceURI .
'}' . $name;
105 $this->properties[
'name'] = $name;
127 if (!isset($this->properties[$field])) {
128 throw new \UnexpectedValueException(
"Unknown property '$field'");
131 return $this->properties[$field];
145 if ($this->properties[
'nodeType'] == \XMLReader::ELEMENT &&
146 $this->properties[
'isEmptyElement'] ==
true) {
147 $this->properties[
'nodeType'] = \XMLReader::END_ELEMENT;
148 $this->properties[
'isEmptyElement'] =
false;
An XML node as read from an XML reader.
const UNSUPPORTED_ENCODING
Alias for the corresponding interoperability fault.
__construct(\XMLReader $reader, $validate, $subtrees)
const INVALID_XML_RPC
Alias for the corresponding interoperability fault.
emptyNodeExpansionWorked()
const INTERNAL_ERROR
Alias for the corresponding interoperability fault.
const NOT_WELL_FORMED
Alias for the corresponding interoperability fault.
$properties
Fields that make up this node.