URI (XmlDoc/XmlNode function): Difference between revisions
m (move footer template to actual end (otherwise subsequent intervening text gets omitted); edits, tags and links) |
|||
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:URI subtitle}} | {{Template:XmlDoc/XmlNode:URI subtitle}} | ||
<var>URI</var> returns "Uniform Resource Identifier" ( | <var>URI</var> returns the "Uniform Resource Identifier" (URI) associated with the name of the node that is the head of an [[XPath]] result. | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc/XmlNode:URI syntax}} | {{Template:XmlDoc/XmlNode:URI syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%unicode</th> | <tr><th>%unicode</th> | ||
<td>A <var>Unicode</var> string variable for the returned | <td>A <var>Unicode</var> string variable for the returned URI. Prior to <var class="product">[[Sirius Mods]]</var> Version 7.6, this variable is an EBCDIC string.</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 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 <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 | <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, and its default is a period (<tt>.</tt>), that is, the node referenced by the method object <var class="term">nr</var>.</p></td></tr> | |||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The Uniform Resource Identifier ( | <li>The Uniform Resource Identifier (URI) of a node is defined to be: | ||
<ul> | <ul> | ||
<li>The | <li>The URI of the namespace declaration in scope for the prefix of the element-type or attribute name if there is one. | ||
<li>The | <li>The URI of the default namespace declaration in scope for an unprefix of element-type. | ||
<li>The null string, otherwise. | <li>The null string, otherwise. | ||
</ul> | </ul> | ||
<li><var>URI</var> may only be used if the <var>XmlDoc</var>'s Namespace property is < | |||
<li>Namespace-aware applications should use the namespace | <li><var>URI</var> may only be used if the <var>XmlDoc</var>'s <var>[[Namespace (XmlDoc property)|Namespace]]</var> property is <var>On</var>. | ||
<li>As of <var class="product"> | |||
<p>As of <var class="product"> | <li>Namespace-aware applications should use the namespace URI rather than the prefix to identify elements. | ||
<li>As of <var class="product">Sirius Mods</var> Version 7.3, the method's argument and result may include only non-null EBCDIC characters that translate to Unicode. | |||
<p> | |||
As of <var class="product">Sirius Mods</var> Version 7.6, these strings are <var>Unicode</var> or are converted to <var>Unicode</var>. For more information about the effects of this Version 7.6 change, see [[XmlDoc API#Strings and Unicode with the XmlDoc API|Strings and Unicode with the XmlDoc API]].</p> | |||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
In the following example, the URI of the first element | |||
In the following example, the | |||
and the null string are printed: | and the null string are printed: | ||
<p class="code">begin | <p class="code">begin | ||
%d | %d object xmlDoc | ||
%d = new | %d = new | ||
%n1 object xmlNode | %n1 object xmlNode | ||
Line 46: | Line 54: | ||
<p class="output">URI = ftp:here | <p class="output">URI = ftp:here | ||
URI = | URI = | ||
</p | </p> | ||
==Request- | ==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>XmlDoc</var> Namespace property not < | <li><var>XmlDoc</var> <var>Namespace</var> property value not <var>On</var>. | ||
<li><var class="term"> | <li><var class="term">xpath</var> expression is invalid. | ||
<li>Result of (<var class="term"> | <li>Result of (<var class="term">xpath</var>) is empty. | ||
<li>Insufficient free space exists in CCATEMP. | <li>Insufficient free space exists in CCATEMP. | ||
</ul> | </ul> | ||
Line 66: | Line 75: | ||
</ul> | </ul> | ||
</ul> | </ul> | ||
{{Template:XmlDoc/XmlNode:URI footer}} | {{Template:XmlDoc/XmlNode:URI footer}} |
Latest revision as of 19:22, 4 May 2016
Namespace URI of name of selected node (XmlDoc and XmlNode classes)
URI returns the "Uniform Resource Identifier" (URI) associated with the name of the node that 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 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, and 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
In the following example, the URI of the first element and the null string are printed:
begin %d object 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
This list is not exhaustive: it does not include all the errors that are request cancelling.
- XmlDoc Namespace property value not On.
- 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.
- These methods also obtain information about the name of a node: