DefaultURI (XmlDoc/XmlNode function): Difference between revisions
m (move footer template to actual end; edits, tags and links) |
m (→Syntax terms) |
||
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 <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 <var>XPath</var> | <td>A <var>Unicode</var> string that is an <var>[[XPath#XPath_syntax|Xpath expression]]</var> that results in a <var>nodelist</var>. The head of the <var>nodelist</var> 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>). | ||
<p>Prior to <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.6, this is an EBCDIC string.</p></td></tr> | <p>Prior to <var class="product">[[Sirius Mods|"Sirius Mods"]]</var> Version 7.6, this is an EBCDIC string.</p></td></tr> | ||
</table> | </table> |
Revision as of 09:13, 22 May 2011
Default URI in scope at selected node (XmlDoc and XmlNode classes)
The DefaultURI function returns the Uniform Resource Identifier (URI) associated with the default namespace declaration that is in scope at a node that is the head of an XPath result.
Syntax
%unicode = nr:DefaultURI[( [xpath])] Throws XPathError
Syntax terms
%unicode | A string variable for the returned URI. |
---|---|
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. An optional argument, its default is a period (. ), that is, the node referenced by the method object (nr).
Prior to "Sirius Mods" Version 7.6, this is an EBCDIC string. |
Usage Notes
- DefaultURI is new as of "Sirius Mods" Version 6.9.
Examples
- In the following example, two elements are added along with their namespace URIs, but only the second added element, which has no prefix, has a default namespace URI:
begin %d object xmlDoc auto new %n object xmlNode %n2 object xmlNode %n = %d:addElement('p:top', , 'urn:top') %n2 = %n:addElement('inner', , 'urn:default') %n:print print 'URI of p:top default namespace =' and %n:defaultURI print 'URI of inner default namespace =' and %n2:defaultURI end
The following lines are printed:
<p:top xmlns:p="urn:top"> <inner xmlns="urn:default"/> </p:top> URI of p:top default namespace = URI of inner default namespace = urn:default
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.
- For more information about namespace declarations, see "Names and namespaces".
- For more information about URIs, see "Uniform Resource Identifier syntax".
- The PrefixURI method returns the URI bound to a node's prefix (or the default URI, if a node has a default namespace declaration). The URI method returns the URI bound to a node's name, if any.
- These methods add namespace URIs to XmlDoc nodes: