4.33. Xml::XmlReader Class

The XmlReader class allows XML strings to be iterated and parsed piecewise.

Table 4.1062. XmlReader Class Method Overview

Method

Except?

Description

XmlReader::constructor()

Y

Creates the XmlReader object based on the XmlDoc object or XML string passed.

XmlReader::destructor()

N

Destroys the XmlReader object.

XmlReader::copy()

N

Creates an independent copy of the XmlReader object.

XmlReader::read()

Y

Moves the position of the current instance to the next node in the stream.

XmlReader::readSkipWhitespace()

Y

Moves the position of the current instance to the next node in the stream, skipping any whitespace nodes.

XmlReader::nodeType()

N

Returns the node type of the current node; for return values, see XML Node Type Constants.

XmlReader::nodeTypeName()

N

Returns a string giving the node type of the current node; for possible return values, see the values of the NodeTypeMap constant.

XmlReader::depth()

N

Returns the depth of the node in the tree.

XmlReader::name()

N

Returns the qualified name of the node (prefix:LocalName) or NOTHING if no name is available.

XmlReader::value()

N

Returns the text value of the node or NOTHING if not available.

XmlReader::hasAttributes()

N

Returns True if the node has attributes or False if not.

XmlReader::hasValue()

N

Returns True if the node has a text value or False if not.

XmlReader::isDefault()

N

Returns True if an attribute node was generated from the default value defined in the DTD or schema, False if not.

XmlReader::isEmptyElement()

N

Returns True if the current node is empty or False if not.

XmlReader::isNamespaceDecl()

N

Returns True if the current node is a namespace declaration rather than a regular attribute or False if not.

XmlReader::isValid()

N

Returns True if the current reader parser context is valid, False if not

XmlReader::toQore()

Y

Returns a hash corresponding to the XML string from the current node position, including all its children.

XmlReader::toQoreData()

Y

Returns a hash corresponding to the XML string from the current node position, including all its children.

XmlReader::attributeCount()

N

Returns the number of attributes of the current node

XmlReader::baseUri()

N

Returns the base URI of the node if known, NOTHING if not.

XmlReader::encoding()

N

Returns the encoding of the XML string

XmlReader::localName()

N

Returns the local name of the node or NOTHING if no name is available.

XmlReader::namespaceUri()

N

Returns the URI defining the namespace associated with the node, or NOTHING if not available.

XmlReader::prefix()

N

Returns the shorthand reference to the namespace associated with the node, or NOTHING if not available.

XmlReader::xmlLang()

N

Returns the xml:lang scope within which the node resides or NOTHING if there is none.

XmlReader::xmlVersion()

N

Returns a string giving the XML version of the source document (normally "1.

XmlReader::getAttribute()

Y

Returns the value of the attribute matching the qualified name passed, or NOTHING if no such attribute exists in the current XmlReader.

XmlReader::getAttributeNs()

Y

Returns the value of the given attribute anchored in the given namespace, or NOTHING if no such attribute exists in the current XmlReader.

XmlReader::getAttributeOffset()

N

Returns the value of the attribute with the specified index relative to the containing element, or NOTHING if no such attribute exists in the current XmlReader.

XmlReader::lookupNamespace()

N

returns the namespace corresponding to the given prefix in the scope of the current element.

XmlReader::moveToAttribute()

Y

Moves the position of the current instance to the attribute with the specified qualified name.

XmlReader::moveToAttributeNs()

Y

Moves the position of the current instance to the attribute with the specified local name and namespace URI.

XmlReader::moveToAttributeOffset()

N

Moves the position of the current instance to the attribute with the specified index relative to the containing element.

XmlReader::moveToElement()

N

Moves the position of the current instance to the element node containing the current attribute node.

XmlReader::moveToFirstAttribute()

N

Moves the position of the current instance to the first attribute of the current node.

XmlReader::moveToNextAttribute()

N

Moves the position of the current instance to the next attribute of the current node.

XmlReader::next()

Y

Moves the position of the current instance to the next node in the tree at the same level, skipping any subtree.

XmlReader::getInnerXml()

N

Returns an XML string of the contents of the all current node's child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes.

XmlReader::getOuterXml()

N

Returns an XML string of the contents of the current node and all child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes.

XmlReader::relaxNGValidate()

Y

Set a RelaxNG schema for schema validation while parsing the XML document. This method must be called before the first call to XmlReader::read()

XmlReader::schemaValidate()

Y

Set an XSD schema for schema validation while parsing the XML document. This method must be called before the first call to XmlReader::read()


4.33.1. XmlReader::constructor()

Synopsis

Creates the XmlReader object based on the XmlDoc object or XML string passed.

Usage
XmlReader::constructor(xmldoc | xmlstr)
Example
$xmlreader = new XmlReader($xml);

Table 4.1063. Arguments for XmlReader::constructor()

Argument

Type

Description

xmldoc

XmlDoc

The pre-parsed XML document object to iterate through.

xmlstr

String

The XML string to parse.


Table 4.1064. Return Values for XmlReader::constructor()

Return Type

Description

Object

The XmlReader object is returned


Table 4.1065. Exceptions thrown by XmlReader::constructor()

err

desc

XMLNODE-CONSTRUCTOR-ERROR

missing or invalid arguments


4.33.2. XmlReader::destructor()

Synopsis

Destroys the XmlReader object.

Usage
delete lvalue
Example
delete $xmlreader;

4.33.3. XmlReader::copy()

Synopsis

Creates an independent copy of the XmlReader object.

Usage
XmlReader::copy()
Example
$value = $xmlreader.copy();

Table 4.1066. Return Values for XmlReader::copy()

Return Type

Description

XmlReader

a copy of the current object


4.33.4. XmlReader::read()

Synopsis

Moves the position of the current instance to the next node in the stream. Returns True if the read was successful, False if there are no more nodes to read. If an error occurs parsing the XML string, an exception is raised (see below).

See also XmlReader::readSkipWhitespace().

Usage
XmlReader::read()
Example
$value = $xmlreader.read();

Table 4.1067. Arguments for XmlReader::read()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1068. Return Values for XmlReader::read()

Return Type

Description

Boolean

True if the read was successful, False if there are no more nodes to read


Table 4.1069. Exceptions thrown by XmlReader::read()

err

desc

PARSE-XML-EXCEPTION

cannot move to next node due to an error parsing the XML string (exception description string contains details about the error)


4.33.5. XmlReader::readSkipWhitespace()

Synopsis

Moves the position of the current instance to the next node in the stream, skipping any whitespace nodes. Returns True if the read was successful, False if there are no more nodes to read. If an error occurs parsing the XML string, an exception is raised (see below).

See also XmlReader::read().

Usage
XmlReader::readSkipWhitespace()
Example
$value = $xmlreader.readSkipWhitespace();

Table 4.1070. Arguments for XmlReader::readSkipWhitespace()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1071. Return Values for XmlReader::readSkipWhitespace()

Return Type

Description

Boolean

True if the read was successful, False if there are no more nodes to read


Table 4.1072. Exceptions thrown by XmlReader::readSkipWhitespace()

err

desc

PARSE-XML-EXCEPTION

cannot move to next node due to an error parsing the XML string (exception description string contains details about the error)


4.33.6. XmlReader::nodeType()

Synopsis

Returns the node type of the current node; for return values, see XML Node Type Constants.

See also NodeTypeMap.

See also XmlReader::nodeTypeName()

Usage
XmlReader::nodeType()
Example
$value = $xmlreader.nodeType();

Table 4.1073. Arguments for XmlReader::nodeType()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1074. Return Values for XmlReader::nodeType()

Return Type

Description

Integer

the node type of the current node; for return values, see XML Node Type Constants


4.33.7. XmlReader::nodeTypeName()

Synopsis

Returns a string giving the node type of the current node; for possible return values, see the values of the NodeTypeMap constant.

See also XmlReader::nodeType()

Usage
XmlReader::nodeTypeName()
Example
$value = $xmlreader.nodeTypeName();

Table 4.1075. Arguments for XmlReader::nodeTypeName()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1076. Return Values for XmlReader::nodeTypeName()

Return Type

Description

String

a string giving the node type of the current node; for possible return values, see the values of the NodeTypeMap constant


4.33.8. XmlReader::depth()

Synopsis

Returns the depth of the node in the tree.

Usage
XmlReader::depth()
Example
$value = $xmlreader.depth();

Table 4.1077. Arguments for XmlReader::depth()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1078. Return Values for XmlReader::depth()

Return Type

Description

Integer

the depth of the node in the tree


4.33.9. XmlReader::name()

Synopsis

Returns the qualified name of the node (prefix:LocalName) or NOTHING if no name is available.

See also XmlReader::localName().

Usage
XmlReader::name()
Example
$value = $xmlreader.name();

Table 4.1079. Arguments for XmlReader::name()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1080. Return Values for XmlReader::name()

Return Type

Description

String

the qualified name of the node (prefix:LocalName) or NOTHING if no name is available


4.33.10. XmlReader::value()

Synopsis

Returns the text value of the node or NOTHING if not available.

Usage
XmlReader::value()
Example
$value = $xmlreader.value();

Table 4.1081. Arguments for XmlReader::value()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1082. Return Values for XmlReader::value()

Return Type

Description

String

the text value of the node or NOTHING if not available


4.33.11. XmlReader::hasAttributes()

Synopsis

Returns True if the node has attributes or False if not.

Usage
XmlReader::hasAttributes()
Example
$value = $xmlreader.hasAttributes();

Table 4.1083. Arguments for XmlReader::hasAttributes()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1084. Return Values for XmlReader::hasAttributes()

Return Type

Description

Boolean

True if the node has attributes, False if not


4.33.12. XmlReader::hasValue()

Synopsis

Returns True if the node has a text value or False if not.

Usage
XmlReader::hasValue()
Example
$value = $xmlreader.hasValue();

Table 4.1085. Arguments for XmlReader::hasValue()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1086. Return Values for XmlReader::hasValue()

Return Type

Description

Boolean

True if the node has a text value, False if not


4.33.13. XmlReader::isDefault()

Synopsis

Returns True if an attribute node was generated from the default value defined in the DTD or schema, False if not.

Usage
XmlReader::isDefault()
Example
$value = $xmlreader.isDefault();

Table 4.1087. Arguments for XmlReader::isDefault()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1088. Return Values for XmlReader::isDefault()

Return Type

Description

Boolean

True if the node an attribute node was generated from the default value defined in the DTD or schema, False if not


4.33.14. XmlReader::isEmptyElement()

Synopsis

Returns True if the current node is empty or False if not.

Usage
XmlReader::isEmptyElement()
Example
$value = $xmlreader.isEmptyElement();

Table 4.1089. Arguments for XmlReader::isEmptyElement()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1090. Return Values for XmlReader::isEmptyElement()

Return Type

Description

Boolean

True if the current node is empty, False if not


4.33.15. XmlReader::isNamespaceDecl()

Synopsis

Returns True if the current node is a namespace declaration rather than a regular attribute or False if not.

Usage
XmlReader::isNamespaceDecl()
Example
$value = $xmlreader.isNamespaceDecl();

Table 4.1091. Arguments for XmlReader::isNamespaceDecl()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1092. Return Values for XmlReader::isNamespaceDecl()

Return Type

Description

Boolean

True if the current node is a namespace declaration rather than a regular attribute, False if not


4.33.16. XmlReader::isValid()

Synopsis

Returns True if the current reader parser context is valid, False if not

Usage
XmlReader::isValid()
Example
$value = $xmlreader.isValid();

Table 4.1093. Arguments for XmlReader::isValid()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1094. Return Values for XmlReader::isValid()

Return Type

Description

Boolean

True if the current reader parser context is valid, False if not


4.33.17. XmlReader::toQore()

Synopsis

Returns a hash corresponding to the XML string from the current node position, including all its children. If duplicate, out-of-order XML elements are found in the input string, they are deserialized to Qore hash elements with the same name as the XML element but including a caret "^" and a numeric prefix to maintain the same key order in the Qore hash as in the input XML string.

Functionally similar to parseXML()

Usage
XmlReader::toQore()
Example
$value = $xmlreader.toQore();

Table 4.1095. Arguments for XmlReader::toQore()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1096. Return Values for XmlReader::toQore()

Return Type

Description

Hash

a hash corresponding to the XML string from the current node position, including all its children; maintains XML element order by appending a suffix to key names


Table 4.1097. Exceptions thrown by XmlReader::toQore()

err

desc

PARSE-XML-EXCEPTION

error parsing the XML string (exception description string contains details about the error)


4.33.18. XmlReader::toQoreData()

Synopsis

Returns a hash corresponding to the XML string from the current node position, including all its children. Note that data deserialized with this method may not be reserialized to an identical XML string due to the fact that XML elements with the same name are collapsed into Qore lists in the resulting Qore hash irrespective of the order in the original XML string.

Functionally similar to parseXMLAsData()

Usage
XmlReader::toQoreData()
Example
$value = $xmlreader.toQoreData();

Table 4.1098. Arguments for XmlReader::toQoreData()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1099. Return Values for XmlReader::toQoreData()

Return Type

Description

Hash

a hash corresponding to the XML string from the current node position, including all its children; does not guarantee to maintain XML element order in the hash as elements at the same level with the same name are collapsed to a Qore list


Table 4.1100. Exceptions thrown by XmlReader::toQoreData()

err

desc

PARSE-XML-EXCEPTION

error parsing the XML string (exception description string contains details about the error)


4.33.19. XmlReader::attributeCount()

Synopsis

Returns the number of attributes of the current node

Usage
XmlReader::attributeCount()
Example
$value = $xmlreader.attributeCount();

Table 4.1101. Arguments for XmlReader::attributeCount()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1102. Return Values for XmlReader::attributeCount()

Return Type

Description

Integer

the number of attributes of the current node


4.33.20. XmlReader::baseUri()

Synopsis

Returns the base URI of the node if known, NOTHING if not.

Usage
XmlReader::baseUri()
Example
$value = $xmlreader.baseUri();

Table 4.1103. Arguments for XmlReader::baseUri()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1104. Return Values for XmlReader::baseUri()

Return Type

Description

String

the base URI of the node if known, NOTHING if not


4.33.21. XmlReader::encoding()

Synopsis

Returns the encoding of the XML string

Usage
XmlReader::encoding()
Example
$value = $xmlreader.encoding();

Table 4.1105. Arguments for XmlReader::encoding()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1106. Return Values for XmlReader::encoding()

Return Type

Description

String

the encoding of the XML string


4.33.22. XmlReader::localName()

Synopsis

Returns the local name of the node or NOTHING if no name is available.

Usage
XmlReader::localName()
Example
$value = $xmlreader.localName();

Table 4.1107. Arguments for XmlReader::localName()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1108. Return Values for XmlReader::localName()

Return Type

Description

String

the local name of the node or NOTHING if no name is available


4.33.23. XmlReader::namespaceUri()

Synopsis

Returns the URI defining the namespace associated with the node, or NOTHING if not available.

Usage
XmlReader::namespaceUri()
Example
$value = $xmlreader.namespaceUri();

Table 4.1109. Arguments for XmlReader::namespaceUri()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1110. Return Values for XmlReader::namespaceUri()

Return Type

Description

String

the URI defining the namespace associated with the node or NOTHING if not available


4.33.24. XmlReader::prefix()

Synopsis

Returns the shorthand reference to the namespace associated with the node, or NOTHING if not available.

Usage
XmlReader::prefix()
Example
$value = $xmlreader.prefix();

Table 4.1111. Arguments for XmlReader::prefix()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1112. Return Values for XmlReader::prefix()

Return Type

Description

String

the shorthand reference to the namespace associated with the node or NOTHING if not available


4.33.25. XmlReader::xmlLang()

Synopsis

Returns the xml:lang scope within which the node resides or NOTHING if there is none.

Usage
XmlReader::xmlLang()
Example
$value = $xmlreader.xmlLang();

Table 4.1113. Arguments for XmlReader::xmlLang()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1114. Return Values for XmlReader::xmlLang()

Return Type

Description

String

the xml:lang scope within which the node resides or NOTHING if there is none


4.33.26. XmlReader::xmlVersion()

Synopsis

Returns a string giving the XML version of the source document (normally "1.0").

Usage
XmlReader::xmlVersion()
Example
$value = $xmlreader.xmlVersion();

Table 4.1115. Arguments for XmlReader::xmlVersion()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1116. Return Values for XmlReader::xmlVersion()

Return Type

Description

String

a string giving the XML version of the source document (normally "1.0")


4.33.27. XmlReader::getAttribute()

Synopsis

Returns the value of the attribute matching the qualified name passed, or NOTHING if no such attribute exists in the current XmlReader.

See also XmlReader::getAttributeNs()

Usage
XmlReader::getAttribute(name)
Example
$value = $xmlreader.getAttribute($name);

Table 4.1117. Arguments for XmlReader::getAttribute()

Argument

Type

Description

name

String

The qualified name of the attribute to retrieve


Table 4.1118. Return Values for XmlReader::getAttribute()

Return Type

Description

String

the value of the attribute or NOTHING if it does not exist


Table 4.1119. Exceptions thrown by XmlReader::getAttribute()

err

desc

XMLREADER-GETATTRIBUTE-ERROR

missing or invalid argument


4.33.28. XmlReader::getAttributeNs()

Synopsis

Returns the value of the given attribute anchored in the given namespace, or NOTHING if no such attribute exists in the current XmlReader.

See also XmlReader::getAttribute()

Usage
XmlReader::getAttributeNs(localname, namespaceuri)
Example
$value = $xmlreader.getAttributeNs($localname, $namespaceuri);

Table 4.1120. Arguments for XmlReader::getAttributeNs()

Argument

Type

Description

localname

String

The local name of the attribute to retrieve

namespaceuri

String

The namespace URI of the attribute


Table 4.1121. Return Values for XmlReader::getAttributeNs()

Return Type

Description

String

the value of the attribute or NOTHING if it does not exist


Table 4.1122. Exceptions thrown by XmlReader::getAttributeNs()

err

desc

XMLREADER-GETATTRIBUTENS-ERROR

missing or invalid argument


4.33.29. XmlReader::getAttributeOffset()

Synopsis

Returns the value of the attribute with the specified index relative to the containing element, or NOTHING if no such attribute exists in the current XmlReader.

See also XmlReader::getAttribute()

Usage
XmlReader::getAttributeOffset(offset)
Example
$value = $xmlreader.getAttributeOffset($offset);

Table 4.1123. Arguments for XmlReader::getAttributeOffset()

Argument

Type

Description

offset

Integer

the index of the attribute relative to the containing element


Table 4.1124. Return Values for XmlReader::getAttributeOffset()

Return Type

Description

String

the value of the attribute or NOTHING if it does not exist


4.33.30. XmlReader::lookupNamespace()

Synopsis

returns the namespace corresponding to the given prefix in the scope of the current element. If no prefix is given, the default namespace is returned.

Usage
XmlReader::lookupNamespace(prefix)
Example
$value = $xmlreader.lookupNamespace($prefix);

Table 4.1125. Arguments for XmlReader::lookupNamespace()

Argument

Type

Description

prefix

String

The namespace prefix to resolve; if no value is sent for this argument, the default namespace is returned.


Table 4.1126. Return Values for XmlReader::lookupNamespace()

Return Type

Description

String

The namespace corresponding to the given prefix in the scope of the current element or NOTHING if the prefix could not be resolved.


4.33.31. XmlReader::moveToAttribute()

Synopsis

Moves the position of the current instance to the attribute with the specified qualified name.

See also XmlReader::moveToAttributeNs()

Usage
XmlReader::moveToAttribute(name)
Example
$value = $xmlreader.moveToAttribute($name);

Table 4.1127. Arguments for XmlReader::moveToAttribute()

Argument

Type

Description

name

String

The qualified name of the attribute to move to


Table 4.1128. Return Values for XmlReader::moveToAttribute()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


Table 4.1129. Exceptions thrown by XmlReader::moveToAttribute()

err

desc

XMLREADER-MOVETOATTRIBUTE-ERROR

missing or invalid argument


4.33.32. XmlReader::moveToAttributeNs()

Synopsis

Moves the position of the current instance to the attribute with the specified local name and namespace URI.

See also XmlReader::moveToAttribute()

Usage
XmlReader::moveToAttributeNs(localname, namespaceuri)
Example
$value = $xmlreader.moveToAttributeNs($localname, $namespaceuri);

Table 4.1130. Arguments for XmlReader::moveToAttributeNs()

Argument

Type

Description

localname

String

The local name of the attribute to move to

namespaceuri

String

The namespace URI of the attribute


Table 4.1131. Return Values for XmlReader::moveToAttributeNs()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


Table 4.1132. Exceptions thrown by XmlReader::moveToAttributeNs()

err

desc

XMLREADER-MOVETOATTRIBUTENS-ERROR

missing or invalid argument


4.33.33. XmlReader::moveToAttributeOffset()

Synopsis

Moves the position of the current instance to the attribute with the specified index relative to the containing element.

See also XmlReader::moveToAttribute()

Usage
XmlReader::moveToAttributeOffset(offset)
Example
$value = $xmlreader.moveToAttributeOffset($offset);

Table 4.1133. Arguments for XmlReader::moveToAttributeOffset()

Argument

Type

Description

offset

Integer

the index of the attribute relative to the containing element to move to


Table 4.1134. Return Values for XmlReader::moveToAttributeOffset()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


4.33.34. XmlReader::moveToElement()

Synopsis

Moves the position of the current instance to the element node containing the current attribute node.

Usage
XmlReader::moveToElement()
Example
$value = $xmlreader.moveToElement();

Table 4.1135. Arguments for XmlReader::moveToElement()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1136. Return Values for XmlReader::moveToElement()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


4.33.35. XmlReader::moveToFirstAttribute()

Synopsis

Moves the position of the current instance to the first attribute of the current node.

Usage
XmlReader::moveToFirstAttribute()
Example
$value = $xmlreader.moveToFirstAttribute();

Table 4.1137. Arguments for XmlReader::moveToFirstAttribute()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1138. Return Values for XmlReader::moveToFirstAttribute()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


4.33.36. XmlReader::moveToNextAttribute()

Synopsis

Moves the position of the current instance to the next attribute of the current node.

Usage
XmlReader::moveToNextAttribute()
Example
$value = $xmlreader.moveToNextAttribute();

Table 4.1139. Arguments for XmlReader::moveToNextAttribute()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1140. Return Values for XmlReader::moveToNextAttribute()

Return Type

Description

Integer

1 in case of success, -1 in case of error, 0 if not found


4.33.37. XmlReader::next()

Synopsis

Moves the position of the current instance to the next node in the tree at the same level, skipping any subtree. Returns True if the operation succeeded, False if there are no more nodes to read. If an error occurs parsing the XML string, an exception is raised.

Usage
XmlReader::next()
Example
$value = $xmlreader.next();

Table 4.1141. Arguments for XmlReader::next()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1142. Return Values for XmlReader::next()

Return Type

Description

Boolean


Table 4.1143. Exceptions thrown by XmlReader::next()

err

desc

PARSE-XML-EXCEPTION

an error occured parsing the XML string


4.33.38. XmlReader::getInnerXml()

Synopsis

Returns an XML string of the contents of the all current node's child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes.

See also XmlReader::getOuterXml().

Usage
XmlReader::getInnerXml()
Example
$value = $xmlreader.getInnerXml();

Table 4.1144. Arguments for XmlReader::getInnerXml()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1145. Return Values for XmlReader::getInnerXml()

Return Type

Description

String

an XML string of the contents of all the current node's child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes


4.33.39. XmlReader::getOuterXml()

Synopsis

Returns an XML string of the contents of the current node and all child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes.

See also XmlReader::getInnerXml().

Usage
XmlReader::getOuterXml()
Example
$value = $xmlreader.getOuterXml();

Table 4.1146. Arguments for XmlReader::getOuterXml()

Argument

Type

Description

n/a

n/a

This method takes no arguments.


Table 4.1147. Return Values for XmlReader::getOuterXml()

Return Type

Description

String

an XML string of the contents of the current node and all child nodes and markup, or NOTHING if the current node is neither an element nor an attribute or has no child nodes


4.33.40. XmlReader::relaxNGValidate()

Synopsis

Set a RelaxNG schema for schema validation while parsing the XML document. This method must be called before the first call to XmlReader::read()

If any errors occur, an exception is thrown (see below).

Usage
XmlReader::relaxNGValidate(rng)
Example
$xmlreader.relaxNGValidate($rng);

Table 4.1148. Arguments for XmlReader::relaxNGValidate()

Argument

Type

Description

rng

String

The RelaxNG schema string to use for validation


Table 4.1149. Return Values for XmlReader::relaxNGValidate()

Return Type

Description

n/a

This method returns no value


Table 4.1150. Exceptions thrown by XmlReader::relaxNGValidate()

err

desc

XMLREADER-RELAXNGVALIDATE-ERROR

missing or invalid argument

XMLREADER-RELAXNG-ERROR

invalid RelaxNG schema or method called after the first call to XmlReader::read()


4.33.41. XmlReader::schemaValidate()

Synopsis

Set an XSD schema for schema validation while parsing the XML document. This method must be called before the first call to XmlReader::read()

If any errors occur, an exception is thrown (see below).

Usage
XmlReader::schemaValidate(xsd)
Example
$xmlreader.schemaValidate($xsd);

Table 4.1151. Arguments for XmlReader::schemaValidate()

Argument

Type

Description

xsd

String

The XSD schema string to use for validation


Table 4.1152. Return Values for XmlReader::schemaValidate()

Return Type

Description

n/a

This method returns no value


Table 4.1153. Exceptions thrown by XmlReader::schemaValidate()

err

desc

XMLREADER-SCHEMAVALIDATE-ERROR

missing or invalid argument

XMLREADER-XSD-ERROR

invalid RelaxNG schema or method called after the first call to XmlReader::read()