URI (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (move footer template to actual end (otherwise subsequent intervening text gets omitted); edits, tags and links)
 
m (xpath expression)
Line 11: Line 11:
<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 Root 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 Root node is the context node.</td></tr>
<tr><th>xpath</th>
<tr><th>xpath</th>
<td>A <var>Unicode</var> string that is an <var>[[XPath]]</var> expression which results in a nodelist, The head of the nodelist is the node to process. An optional argument, its default is a period (<code>.</code>), that is, the node referenced by the method object <var class="term">nr</var>.</td></tr>
<td>A <var>Unicode</var> string that is an <var>[[XPath#XPath_syntax|Xpath expression]]</var> which results in a nodelist, The head of the nodelist is the node to process. An optional argument, its default is a period (<code>.</code>), that is, the node referenced by the method object <var class="term">nr</var>.</td></tr>
</table>
</table>



Revision as of 09:25, 22 May 2011

Namespace URI of name of selected node (XmlDoc and XmlNode classes)

URI returns "Uniform Resource Identifier" (URI) associated with the name of the node which is the head of an XPath result.

Syntax

%unicode = nr:URI[( [xpath])] Throws XPathError

Syntax terms

%unicode A Unicode string variable for the returned URI. Prior to "Sirius Mods" Version 7.6, this variable is an EBCDIC string.
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 which results in a nodelist, The head of the nodelist is the node to process. An optional argument, its default is a period (.), that is, the node referenced by the method object nr.

Usage notes

  • The Uniform Resource Identifier (URI) of a node is defined to be:
    • The URI of the namespace declaration in scope for the prefix of the element-type or attribute name if there is one.
    • The URI of the default namespace declaration in scope for an unprefix of element-type.
    • The null string, otherwise.
  • URI may only be used if the XmlDoc's Namespace property is On.
  • Namespace-aware applications should use the namespace URI rather than the prefix to identify elements.
  • As of "Sirius Mods" Version 7.3, the method's argument and result may include only non-null EBCDIC characters that translate to Unicode.

    As of "Sirius Mods" Version 7.6, these strings are Unicode or are converted to Unicode. For more information about the effects of this Version 7.6 change, see "Strings and Unicode with the XmlDoc API".

Examples

  1. In the following example, the URI of the first element and the null string are printed:

    begin %d oject xmlDoc %d = new %n1 object xmlNode %n2 object xmlNode %n1 = %d:addElement('foo:bar', , 'ftp:here') print 'URI =' and %n1:URI %n1 = %n1:addElement('junk') print 'URI =' and %n1:URI end

    The example result follows:

    URI = ftp:here URI =

Request-Cancellation Errors

  • XmlDoc Namespace property not On.
  • 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.
  • These methods also obtain information about the name of a node: