Type (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 7: Line 7:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%nodTypEnum</th>
<tr><th>%nodTypEnum</th>
<td>A declared enumeration object of type XmlNodeType to contain the returned value of Type. These values are listed in "Usage Notes," below. </td></tr>
<td>A declared enumeration object of type <var>XmlNode</var><var>Type</var> to contain the returned value of <var>Type</var>. These values are listed in "Usage Notes," below. </td></tr>
<tr><th>nr</th>
<tr><th>nr</th>
<td>An XmlDoc or XmlNode, used as the context node for the <i>XPath</i> expression. If an XmlDoc, the Root node is the context node. </td></tr>
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <i>XPath</i> expression. If an <var>XmlDoc</var>, the Root node is the context node. </td></tr>
<tr><th>XPath</th>
<tr><th>XPath</th>
<td>A Unicode string that is an 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 expression that results in a nodelist. The head of the nodelist is the node to process.
<p class="code">This is an optional argument whose default is a period (.), that is, the node referenced by the method object (<i>nr</i>). Prior to ''Sirius Mods'' version 7.6, this argument is an EBCDIC string.</td></tr>
<p class="code">This is an optional argument whose default is a period (.), that is, the node referenced by the method object (<i>nr</i>). Prior to ''Sirius Mods'' version 7.6, this argument is an EBCDIC string.</td></tr>
</p>
</p>
Line 18: Line 18:
==Usage notes==
==Usage notes==


The Type function returns an XmlNodeType enumeration value, which may be one
The <var>Type</var> function returns an <var>XmlNode</var><var>Type</var> enumeration value, which may be one
of the following.
of the following.
For more information about enumerations, see [[Enumerations]].
For more information about enumerations, see [[Enumerations]].
Line 33: Line 33:
The following example displays
The following example displays
the string value of the type of the node pointed to by <tt>%nod</tt>:
the string value of the type of the node pointed to by <tt>%nod</tt>:
<p class="code">Print %nod:Type:ToString
<p class="code">Print %nod:<var>Type</var>:To<var>String</var>
</p>
</p>



Revision as of 17:46, 25 January 2011

Type of selected node (XmlDoc and XmlNode classes)


This function gets the type of node of the head of the argument XPath result.

Syntax

%xmlNodeType = nr:Type[( [xpath])] Throws XPathError

Syntax terms

%nodTypEnum A declared enumeration object of type XmlNodeType to contain the returned value of Type. These values are listed in "Usage Notes," below.
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.

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.

Usage notes

The Type function returns an XmlNodeType enumeration value, which may be one of the following. For more information about enumerations, see Enumerations.

  • Attribute
  • Comment
  • Element
  • PI (which stands for Processing Instruction)
  • Root
  • Text

Example

The following example displays the string value of the type of the node pointed to by %nod:

Print %nod:Type:ToString

Request-Cancellation Errors

  • XPath is invalid.
  • Result of (XPath) is empty.
  • Insufficient free space exists in CCATEMP.

See also

  • For more information about using XPath expressions, see XPath.