DefaultURI (XmlDoc/XmlNode function): Difference between revisions
m (→Syntax terms) |
|||
(15 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:DefaultURI subtitle}} | {{Template:XmlDoc/XmlNode:DefaultURI subtitle}} | ||
The <var>DefaultURI</var> function returns the Uniform Resource Identifier (<var>URI</var>) associated with the default namespace declaration that is in scope at a node that is the head of an | The <var>DefaultURI</var> function returns the Uniform Resource Identifier (<var>URI</var>) associated with the default namespace declaration that is in scope at a node that is the head of an XPath result. | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc/XmlNode:DefaultURI syntax}} | {{Template:XmlDoc/XmlNode:DefaultURI syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%unicode</th> | <tr><th nowrap>%unicode</th> | ||
<td>A string variable for the returned <var>URI</var>.</td></tr> | <td>A string variable for the returned <var>URI</var>.</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 <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 [[XPath#XPath_syntax|XPath expression]] that results in a | <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>Prior to <var class="product">[[Sirius Mods | <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> | |||
<p> | |||
Prior to <var class="product">[[Sirius Mods]]</var> Version 7.6, this is an EBCDIC string.</p></td></tr> | |||
</table> | </table> | ||
==Usage | ==Usage notes== | ||
<ul> | <ul> | ||
<li><var>DefaultURI</var> is new as of <var class="product"> | <li><var>DefaultURI</var> is new as of <var class="product">Sirius Mods</var> Version 6.9. | ||
</ul> | </ul> | ||
==Examples== | ==Examples== | ||
In the following example, two elements are added along with their namespace <var>URI</var>s, but only the second added element, which has no prefix, has a default namespace URI: | |||
<p class="code">begin | <p class="code">begin | ||
%d object xmlDoc auto new | %d object xmlDoc auto new | ||
Line 39: | Line 45: | ||
URI of p:top default namespace = | URI of p:top default namespace = | ||
URI of inner default namespace = urn:default | URI of inner default namespace = urn:default | ||
</nowiki></p | </nowiki></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> <var>[[Namespace_(XmlDoc_property)|Namespace]]</var> property not < | <li><var>XmlDoc</var> <var>[[Namespace_(XmlDoc_property)|Namespace]]</var> property value not <var>On</var>. | ||
<li><var class="term"> | <li>The <var class="term">xpath</var> argument 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 51: | Line 58: | ||
==See also== | ==See also== | ||
<ul> | <ul> | ||
<li>For more information about using XPath expressions, see [[XPath]]. | <li>For more information about using XPath expressions, see [[XPath]]. </li> | ||
<li>For more information about namespace declarations, see [[XML processing in Janus SOAP#Names and namespaces| | |||
<li>For more information about URIs, see [[XML_processing_in_Janus_SOAP#Uniform_Resource_Identifier_syntax| | <li>For more information about namespace declarations, see [[XML processing in Janus SOAP#Names and namespaces|Names and namespaces]]. </li> | ||
<li>The <var>[[PrefixURI_(XmlDoc/XmlNode_function)|PrefixURI]]</var> method returns the | |||
<li>These methods add namespace | <li>For more information about URIs, see [[XML_processing_in_Janus_SOAP#Uniform_Resource_Identifier_syntax|Uniform Resource Identifier syntax]]. </li> | ||
<li>The <var>[[PrefixURI_(XmlDoc/XmlNode_function)|PrefixURI]]</var> method returns the URI bound to a node's prefix (or the default URI, if a node has a default namespace declaration). The <var>[[URI (XmlDoc/XmlNode function)|URI]]</var> method returns the URI bound to a node's name, if any. </li> | |||
<li>These methods add namespace URIs to <var>XmlDoc</var> nodes: | |||
<ul> | <ul> | ||
<li><var>[[AddElement (XmlDoc/XmlNode function)|AddElement]]</var> | <li><var>[[AddElement (XmlDoc/XmlNode function)|AddElement]]</var></li> | ||
<li><var>[[AddAttribute (XmlNode function)|AddAttribute]]</var> | <li><var>[[AddAttribute (XmlNode function)|AddAttribute]]</var></li> | ||
<li><var>[[AddNamespace (XmlNode subroutine)|AddNamespace]]</var> | <li><var>[[AddNamespace (XmlNode subroutine)|AddNamespace]]</var></li> | ||
</ul> | </ul></li> | ||
</ul> | </ul> | ||
{{Template:XmlDoc/XmlNode:DefaultURI footer}} | {{Template:XmlDoc/XmlNode:DefaultURI footer}} |
Latest revision as of 21:14, 2 September 2015
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. 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). 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
This list is not exhaustive: it does not include all the errors that are request cancelling.
- XmlDoc Namespace property value not On.
- The xpath argument 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: