IsSelectionPrefix (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (xpath expression)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Template:XmlDoc:IsSelectionPrefix subtitle}}
{{Template:XmlDoc:IsSelectionPrefix subtitle}}
<var>IsSelectionPrefix</var> determines whether its argument is a prefix that can be used in an <var>[[XPath#XPath_syntax|Xpath expression]]</var>.  <var>IsSelectionPrefix</var> returns the value <code>True</code> if its argument is currently associated (either with the null string or with a namespace <var>URI</var>) as a prefix that you can use in an <var>XPath</var> expression. Otherwise, it returns <code>False</code>.
<var>IsSelectionPrefix</var> determines whether its argument is a prefix that can be used in an [[XPath#XPath_syntax|XPath expression]].  <var>IsSelectionPrefix</var> returns the value <code>True</code> if its argument is currently associated (either with the null string or with a namespace URI) as a prefix that you can use in an XPath expression. Otherwise, it returns <code>False</code>.


==Syntax==
==Syntax==
Line 6: Line 6:
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%boolean</th>
<tr><th nowrap>%boolean</th>
<td>A declared enumeration object of type <var>[[Enumerations#Using Boolean enumerations|Boolean]]</var> to contain the returned value (<code>True</code> or <code>False</code>) of <var>IsSelectionPrefix</var>. For more information about enumerations, see [[Enumerations]].</td></tr>
<td>A declared [[Enumerations|enumeration]] object of type <var>[[Enumerations#Using Boolean enumerations|Boolean]]</var> to contain the returned value (<var>True</var> or <var>False</var>) of <var>IsSelectionPrefix</var>.</td></tr>
<tr><th>doc</th>
<tr><th>doc</th>
<td>An <var>XmlDoc</var> object expression. </td></tr>
<td>An <var>XmlDoc</var> object expression. </td></tr>
Line 16: Line 16:
==Usage notes==
==Usage notes==
<ul>
<ul>
<li><var>IsSelectionPrefix</var> has no cancellation conditions other than the usual requirement that the method obj8ect not be Null.
<li><var>IsSelectionPrefix</var> has no cancellation conditions other than the usual requirement that the method obj8ect not be <var>Null</var>.
<li><var>IsSelectionPrefix</var> is available in <var class="product">[[Sirius Mods|Sirius Mods]]</var> Version 7.0 and later.
<li><var>IsSelectionPrefix</var> is available in <var class="product">Sirius Mods</var> Version 7.0 and later.
</ul>
</ul>


==Examples==
==Examples==
<ol><li>In the following example fragment, the code is testing for a new prefix to use in an <var>XPath</var> expression, to avoid having to change any existing prefix associations:
In the following example fragment, the code is testing for a new prefix to use in an XPath expression, to avoid having to change any existing prefix associations:
<p class="code">...
<p class="code">...
for %i from 1 to 100
for %i from 1 to 100
Line 35: Line 35:
%doc:[[DeleteSelectionPrefix_(XmlDoc_subroutine)|deleteSelectionPrefix]]('p' with %i)
%doc:[[DeleteSelectionPrefix_(XmlDoc_subroutine)|deleteSelectionPrefix]]('p' with %i)
...
...
</p></ol>
</p>


==See also==
==See also==
<ul>
<ul>
<li>[[DeleteSelectionPrefix (XmlDoc subroutine)|DeleteSelectionPrefix]] method is useful in conjunction with <var>IsSelectionPrefix</var> to delete the selected subtree.
<li><var>[[DeleteSelectionPrefix (XmlDoc subroutine)|DeleteSelectionPrefix]]</var> is useful in conjunction with <var>IsSelectionPrefix</var> to delete the selected subtree.
<li>[[SelectionNamespace (XmlDoc property)|SelectionNamespace]] specifies the namespace <var>URI</var> associated with a prefix, when the prefix is used in an <var>XPath</var> expression.
<li><var>[[SelectionNamespace (XmlDoc property)|SelectionNamespace]]</var> specifies the namespace URI associated with a prefix, when the prefix is used in an XPath expression.
</ul>
</ul>
{{Template:XmlDoc:IsSelectionPrefix footer}}
{{Template:XmlDoc:IsSelectionPrefix footer}}

Latest revision as of 21:22, 2 September 2015

Check if prefix has XPath-selection association (XmlDoc class)

IsSelectionPrefix determines whether its argument is a prefix that can be used in an XPath expression. IsSelectionPrefix returns the value True if its argument is currently associated (either with the null string or with a namespace URI) as a prefix that you can use in an XPath expression. Otherwise, it returns False.

Syntax

%boolean = doc:IsSelectionPrefix( prefix)

Syntax terms

%boolean A declared enumeration object of type Boolean to contain the returned value (True or False) of IsSelectionPrefix.
doc An XmlDoc object expression.
prefix A string prefix (the part of the name before the colon) for a node. This is a Unicode string argument; prior to Sirius Mods Version 7.6, this is an EBCDIC string. Its length must be at most 255 characters.

Usage notes

  • IsSelectionPrefix has no cancellation conditions other than the usual requirement that the method obj8ect not be Null.
  • IsSelectionPrefix is available in Sirius Mods Version 7.0 and later.

Examples

In the following example fragment, the code is testing for a new prefix to use in an XPath expression, to avoid having to change any existing prefix associations:

... for %i from 1 to 100 if %doc:isSelectionPrefix('p' With %i) eq false then loop end end if end for %doc:selectionNamespace('p' with %i) = 'urn:localxxx' %node = %inpNode:selectSingleNode(%p With %i - with ':infoChild') %doc:deleteSelectionPrefix('p' with %i) ...

See also

  • DeleteSelectionPrefix is useful in conjunction with IsSelectionPrefix to delete the selected subtree.
  • SelectionNamespace specifies the namespace URI associated with a prefix, when the prefix is used in an XPath expression.