URI (XmlDoc/XmlNode function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (1 revision) |
||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:URI subtitle}} | {{Template:XmlDoc/XmlNode:URI subtitle}} | ||
This function gets the "Uniform Resource Identifier" (URI) | This function gets the "Uniform Resource Identifier" (<var>URI</var>) | ||
associated with the name of the node which is the head of an XPath result. | associated with the name of the node which is the head of an XPath result. | ||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%uri</th> | <tr><th>%uri</th> | ||
<td>A Unicode string variable for the returned URI. Prior to ''Sirius Mods'' version 7.6, this variable is an EBCDIC string. </td></tr> | <td>A <var>Unicode</var> string variable for the returned <var>URI</var>. Prior to ''Sirius Mods'' version 7.6, this variable is an EBCDIC string. </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 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 (<i>nr</i>).</td></tr> | <td>A <var>Unicode</var> 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 (<i>nr</i>).</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The Uniform Resource Identifier (URI) of a node is defined to be: | <li>The Uniform Resource Identifier (<var>URI</var>) of a node is defined to be: | ||
<ul> | <ul> | ||
<li>The URI of the namespace declaration in scope for the prefix of the element-type | <li>The <var>URI</var> of the namespace declaration in scope for the prefix of the element-type | ||
or attribute name if there is one. | or attribute name if there is one. | ||
<li>The URI of the default namespace declaration in scope for an unprefix of element-type. | <li>The <var>URI</var> 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>This function may only be used if the XmlDoc's Namespace property is <tt>On</tt>. | <li>This function may only be used if the <var>XmlDoc</var>'s Namespace property is <tt>On</tt>. | ||
<li>Namespace-aware applications should use the namespace URI | <li>Namespace-aware applications should use the namespace <var>URI</var> | ||
rather than the prefix to identify elements. | rather than the prefix to identify elements. | ||
<li>As of ''Sirius Mods'' version 7.3, the method's argument and result may include | <li>As of ''Sirius Mods'' version 7.3, the method's argument and result may include | ||
only non-null EBCDIC characters that translate to Unicode. | only non-null EBCDIC characters that translate to <var>Unicode</var>. | ||
As of ''Sirius Mods'' version 7.6, these strings are Unicode or are converted to Unicode. | As of ''Sirius Mods'' 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 | For more information about the effects of this version 7.6 | ||
Line 37: | Line 37: | ||
===Example=== | ===Example=== | ||
In the following example, the URI of the first element | In the following example, the <var>URI</var> of the first element | ||
and the null string are printed: | and the null string are printed: | ||
<p class="code">Begin | <p class="code">Begin | ||
%d Object XmlDoc | %d <var>Object</var> <var>XmlDoc</var> | ||
%d = New | %d = New | ||
%n1 Object XmlNode | %n1 <var>Object</var> <var>XmlNode</var> | ||
%n2 Object XmlNode | %n2 <var>Object</var> <var>XmlNode</var> | ||
%n1 = %d:AddElement('foo:bar', , 'ftp:here') | %n1 = %d:AddElement('foo:bar', , 'ftp:here') | ||
Print 'URI =' And %n1:URI | Print '<var>URI</var> =' And %n1:<var>URI</var> | ||
%n1 = %n1:AddElement('junk') | %n1 = %n1:AddElement('junk') | ||
Print 'URI =' And %n1:URI | Print '<var>URI</var> =' And %n1:<var>URI</var> | ||
End | End | ||
</p> | </p> | ||
The example result follows: | The example result follows: | ||
<p class="output">URI = ftp:here | <p class="output"><var>URI</var> = ftp:here | ||
URI = | <var>URI</var> = | ||
</p> | </p> | ||
===Request-Cancellation Errors=== | ===Request-Cancellation Errors=== | ||
<ul> | <ul> | ||
<li>XmlDoc Namespace property not <tt>On</tt>. | <li><var>XmlDoc</var> Namespace property not <tt>On</tt>. | ||
<li><i>XPath</i> is invalid. | <li><i>XPath</i> is invalid. | ||
<li>Result of (<i>XPath</i>) is empty. | <li>Result of (<i>XPath</i>) is empty. |
Revision as of 17:46, 25 January 2011
Namespace URI of name of selected node (XmlDoc and XmlNode classes)
This function gets the "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
%uri | 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.
- This function 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.
Example
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
- XmlDoc Namespace property not On.
- XPath is invalid.
- Result of (XPath) is empty.
- Insufficient free space exists in CCATEMP.