The XmlNode class provides information about the components of an XML document. This class currently cannot be constructed manually, but rather can only be returned by the XmlDoc class. It is possible that future versions of Qore will remove this restriction.
Table 4.1019. XmlNode Class Method Overview
Method |
Except? |
Description |
---|---|---|
Y |
Cannot be called manually; throws an exception. | |
N |
Destroys the XmlNode object. | |
N |
Creates an independent copy of the XmlNode object. | |
N |
Returns the number of child elements of the XmlNode. | |
N |
Returns the space-preserving behavior of the XmlNode object. | |
N |
Returns the type of the XmlNode object; for possible values see XML Element Type Constants. | |
N |
Returns the name of the type of the XmlNode object; for possible values see the ElementTypeMap constant. | |
N |
Returns an XmlNode object for the first child of the current XmlNode object that is an XML element, or NOTHING if there is none. | |
N |
Returns an XmlNode object for the last child of the current XmlNode object, or NOTHING if there is none. | |
N |
Returns an XmlNode object for the last child of the current XmlNode object that is an XML element, or NOTHING if there is none. | |
N |
Returns an XmlNode object for the next element at the same level of the current XmlNode object, or NOTHING if there is none. | |
N |
Returns an XmlNode object for the previous element at the same level of the current XmlNode object, or NOTHING if there is none. | |
N |
Returns a string representing a structured path for the current node. | |
Y |
Returns the value of the given property anchored in the given namespace, or NOTHING if no such property exists in the current XmlNode. | |
Y |
Returns the value of the given property, or NOTHING if no such property exists in the current XmlNode. | |
N |
Returns a string of the content of the current node. | |
N |
Returns the name of the current node. | |
N |
Returns the language of the current node, determined by the value of the | |
N |
Returns True if the node is a text node, False if not. | |
N |
Returns True if the node is empty or whitespace only, False if not. | |
N |
Returns XML corresponding to the current node and all its children. |
Cannot be called manually; throws an exception.
XmlNode::constructor()
$xmlnode = new XmlNode();
Table 4.1020. Arguments for XmlNode::constructor()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1021. Return Values for XmlNode::constructor()
Return Type |
Description |
---|---|
n/a |
Currently cannot be used; an exception will be thrown if called manually. |
Table 4.1022. Exceptions thrown by XmlNode::constructor()
err |
desc |
---|---|
|
XmlNode objects cannot be constructed manually |
Destroys the XmlNode object.
delete lvalue
delete $xmlnode;
Creates an independent copy of the XmlNode object.
XmlNode::copy()
$value = $xmlnode.copy();
Table 4.1023. Return Values for XmlNode::copy()
Return Type |
Description |
---|---|
a copy of the current object |
Returns the number of child elements of the XmlNode.
XmlNode::childElementCount()
$value = $xmlnode.childElementCount();
Table 4.1024. Arguments for XmlNode::childElementCount()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1025. Return Values for XmlNode::childElementCount()
Return Type |
Description |
---|---|
Integer |
the number of child elements of the XmlNode |
Returns the space-preserving behavior of the XmlNode object.
XmlNode::getSpacePreserve()
$value = $xmlnode.getSpacePreserve();
Table 4.1026. Arguments for XmlNode::getSpacePreserve()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1027. Return Values for XmlNode::getSpacePreserve()
Return Type |
Description |
---|---|
Integer |
The space-preserving behavior of the XmlNode: -1 = xml:space is not inherited, 0 = default, 1 = preserve |
Returns the type of the XmlNode object; for possible values see XML Element Type Constants.
XmlNode::getElementType()
$value = $xmlnode.getElementType();
Table 4.1028. Arguments for XmlNode::getElementType()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1029. Return Values for XmlNode::getElementType()
Return Type |
Description |
---|---|
Integer |
the type of the XmlNode object; for possible values see XML Element Type Constants |
Returns the name of the type of the XmlNode object; for possible values see the ElementTypeMap constant.
XmlNode::getElementTypeName()
$value = $xmlnode.getElementTypeName();
Table 4.1030. Arguments for XmlNode::getElementTypeName()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1031. Return Values for XmlNode::getElementTypeName()
Return Type |
Description |
---|---|
String |
the name of the type of the XmlNode object; for possible values see the ElementTypeMap constant |
Returns an XmlNode object for the first child of the current XmlNode object that is an XML element, or NOTHING if there is none.
XmlNode::firstElementChild()
$value = $xmlnode.firstElementChild();
Table 4.1032. Arguments for XmlNode::firstElementChild()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Returns an XmlNode object for the last child of the current XmlNode object, or NOTHING if there is none.
XmlNode::getLastChild()
$value = $xmlnode.getLastChild();
Table 4.1034. Arguments for XmlNode::getLastChild()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Returns an XmlNode object for the last child of the current XmlNode object that is an XML element, or NOTHING if there is none.
XmlNode::lastElementChild()
$value = $xmlnode.lastElementChild();
Table 4.1036. Arguments for XmlNode::lastElementChild()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Returns an XmlNode object for the next element at the same level of the current XmlNode object, or NOTHING if there is none.
XmlNode::nextElementSibling()
$value = $xmlnode.nextElementSibling();
Table 4.1038. Arguments for XmlNode::nextElementSibling()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Returns an XmlNode object for the previous element at the same level of the current XmlNode object, or NOTHING if there is none.
XmlNode::previousElementSibling()
$value = $xmlnode.previousElementSibling();
Table 4.1040. Arguments for XmlNode::previousElementSibling()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Returns a string representing a structured path for the current node.
XmlNode::getPath()
$value = $xmlnode.getPath();
Table 4.1042. Arguments for XmlNode::getPath()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1043. Return Values for XmlNode::getPath()
Return Type |
Description |
---|---|
String |
a string representing a structured path for the current node |
Returns the value of the given property anchored in the given namespace, or NOTHING if no such property exists in the current XmlNode.
XmlNode::getNsProp(prop, namespace
)
$value = $xmlnode.getNsProp($prop, $namespace);
Table 4.1044. Arguments for XmlNode::getNsProp()
Argument |
Type |
Description |
---|---|---|
|
String |
The name of the property to retrieve |
|
String |
The name of the namespace of the property |
Table 4.1045. Return Values for XmlNode::getNsProp()
Return Type |
Description |
---|---|
String |
the value of the property or NOTHING if it does not exist |
Table 4.1046. Exceptions thrown by XmlNode::getNsProp()
err |
desc |
---|---|
|
missing or invalid argument |
Returns the value of the given property, or NOTHING if no such property exists in the current XmlNode.
XmlNode::getProp(prop
)
$value = $xmlnode.getProp($prop);
Table 4.1047. Arguments for XmlNode::getProp()
Argument |
Type |
Description |
---|---|---|
|
String |
The name of the property to retrieve |
Table 4.1048. Return Values for XmlNode::getProp()
Return Type |
Description |
---|---|
String |
the value of the property or NOTHING if it does not exist |
Table 4.1049. Exceptions thrown by XmlNode::getProp()
err |
desc |
---|---|
|
missing or invalid argument |
Returns a string of the content of the current node.
XmlNode::getContent()
$value = $xmlnode.getContent();
Table 4.1050. Arguments for XmlNode::getContent()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1051. Return Values for XmlNode::getContent()
Return Type |
Description |
---|---|
String |
a string of the content of the current node |
Returns the name of the current node.
XmlNode::getName()
$value = $xmlnode.getName();
Table 4.1052. Arguments for XmlNode::getName()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1053. Return Values for XmlNode::getName()
Return Type |
Description |
---|---|
String |
the name of the current node |
Returns the language of the current node, determined by the value of the xml:lang
attribute of this node or of the nearest ancestor. If no such property is available, then NOTHING is returned.
XmlNode::getLang()
$value = $xmlnode.getLang();
Table 4.1054. Arguments for XmlNode::getLang()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1055. Return Values for XmlNode::getLang()
Return Type |
Description |
---|---|
String |
the language of the current node, determined by the value of the |
Returns True if the node is a text node, False if not.
XmlNode::isText()
$value = $xmlnode.isText();
Table 4.1056. Arguments for XmlNode::isText()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1057. Return Values for XmlNode::isText()
Return Type |
Description |
---|---|
Boolean |
True if the node is a text node, False if not |
Returns True if the node is empty or whitespace only, False if not.
XmlNode::isBlank()
$value = $xmlnode.isBlank();
Table 4.1058. Arguments for XmlNode::isBlank()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1059. Return Values for XmlNode::isBlank()
Return Type |
Description |
---|---|
Boolean |
True if the node is empty or whitespace only, False if not |
Returns XML corresponding to the current node and all its children.
XmlNode::getXML()
$value = $xmlnode.getXML();
Table 4.1060. Arguments for XmlNode::getXML()
Argument |
Type |
Description |
---|---|---|
n/a |
n/a |
This method takes no arguments. |
Table 4.1061. Return Values for XmlNode::getXML()
Return Type |
Description |
---|---|
String |
XML corresponding to the current node and all its children |