Type (XmlDoc/XmlNode function): Difference between revisions
m (xpath arg) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:Type subtitle}} | {{Template:XmlDoc/XmlNode:Type subtitle}} | ||
<var>Type</var> returns the type of node of the head of the argument XPath result. | <var>Type</var> returns the [[XmlDoc API#XmlDoc node types|type of node]] of the head of the argument XPath result. | ||
<div id="xmlnodetype"></div> | <div id="xmlnodetype"></div> | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc/XmlNode:Type syntax}} | {{Template:XmlDoc/XmlNode:Type syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%xmlNodeType</th> | <tr><th>%xmlNodeType</th> | ||
<td>A declared enumeration object of type <var>XmlNodeType</var> (see below) to contain the returned value of <var>Type</var>. </td></tr> | <td>A declared enumeration object of type <var>XmlNodeType</var> (see below) to contain the returned value of <var>Type</var>. </td></tr> | ||
<tr><th>nr</th> | <tr><th>nr</th> | ||
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var class="term">xpath</var> expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node. </td></tr> | <td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var class="term">xpath</var> expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node. </td></tr> | ||
<tr><th>xpath</th> | <tr><th>xpath</th> | ||
<td>A <var>Unicode</var> string that is an [[XPath#XPath_syntax|Xpath expression]] that results in a nodelist. The head of the nodelist is the node to process. | <td>A <var>Unicode</var> string that is an [[XPath#XPath_syntax|Xpath expression]] that results in a nodelist. The head of the nodelist is the node to process. Any other nodes in the nodelist are ignored. | ||
<p>This is an optional argument whose default is a period (<tt>.</tt>), that is, the node referenced by the method object (<var class="term">nr</var>). Prior to <var class="product">[[Sirius Mods]]</var> Version 7.6, this argument is an EBCDIC string.</p></td></tr> | <p> | ||
This is an optional argument whose default is a period (<tt>.</tt>), that is, the node referenced by the method object (<var class="term">nr</var>). Prior to <var class="product">[[Sirius Mods]]</var> Version 7.6, this argument is an EBCDIC string.</p></td></tr> | |||
</table> | </table> | ||
Line 31: | Line 35: | ||
</p> | </p> | ||
'''Note:''' Specifying <code>toString</code> above is optional: As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods| | <p class="note">'''Note:''' Specifying <code>toString</code> above is optional: As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|Common enumeration methods]]. </p> | ||
==Request-cancellation errors== | ==Request-cancellation errors== | ||
This list is not exhaustive: it does <i>not</i> include all the errors that are request cancelling. | |||
<ul> | <ul> | ||
<li><var class="term">xpath</var> expression is invalid. | <li><var class="term">xpath</var> expression is invalid. | ||
Line 42: | Line 47: | ||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li>For more information about using XPath expressions, see [[XPath | <li>For more information about using XPath expressions, see [[XPath]].</li> | ||
</ul> | </ul> | ||
{{Template:XmlDoc/XmlNode:Type footer}} | {{Template:XmlDoc/XmlNode:Type footer}} |
Latest revision as of 18:01, 18 February 2015
Type of selected node (XmlDoc and XmlNode classes)
Type returns the type of node of the head of the argument XPath result.
Syntax
%xmlNodeType = nr:Type[( [xpath])] Throws XPathError
Syntax terms
%xmlNodeType | A declared enumeration object of type XmlNodeType (see below) to contain the returned value of Type. |
---|---|
nr | An XmlDoc or XmlNode, used as the context node for the xpath expression. If an XmlDoc, the Root node is the context node. |
xpath | A Unicode string that is an Xpath expression that results in a nodelist. The head of the nodelist is the node to process. Any other nodes in the nodelist are ignored.
This is an optional argument whose default is a period (.), that is, the node referenced by the method object (nr). Prior to Sirius Mods Version 7.6, this argument is an EBCDIC string. |
XmlNodeType enumeration
Type returns an XmlNodeType enumeration value, which may be one of the following node types:
- Attribute
- Comment
- Element
- PI (which stands for Processing Instruction)
- Root
- Text
Examples
The following example displays the string value of the type of the node pointed to by %nod
:
print %nod:type:toString
Note: Specifying toString
above is optional: As with all enumerations, the ToString method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see Common enumeration methods.
Request-cancellation errors
This list is not exhaustive: it does not include all the errors that are request cancelling.
- xpath expression is invalid.
- Result of xpath is empty.
- Insufficient free space exists in CCATEMP.
See also
- For more information about using XPath expressions, see XPath.