IsSelectionPrefix (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 3: Line 3:
This function determines whether its argument is a prefix that
This function determines whether its argument is a prefix that
can be used in an XPath expression.
can be used in an XPath expression.
IsSelectionPrefix returns the value <tt>True</tt>
<var>IsSelectionPrefix</var> returns the value <tt>True</tt>
if its argument is currently associated (either with the null string or with a
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.
namespace URI) as a prefix that you can use in an XPath expression.
Line 14: Line 14:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th><i><b>%bool</b></i></th>
<tr><th><i><b>%bool</b></i></th>
<td>A declared enumeration object of type Boolean to contain the returned value (<tt>True</tt> or <tt>False</tt>) of IsSelectionPrefix. For more information about enumerations, see [[Enumerations]]. </td></tr>
<td>A declared enumeration object of type Boolean to contain the returned value (<tt>True</tt> or <tt>False</tt>) of <var>IsSelectionPrefix</var>. For more information about enumerations, see [[Enumerations]]. </td></tr>
<tr><th>doc</th>
<tr><th>doc</th>
<td>An XmlDoc object expression. </td></tr>
<td>An <var>XmlDoc</var> object expression. </td></tr>
<tr><th>prefix</th>
<tr><th>prefix</th>
<td>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.</td></tr>
<td>A string prefix (the part of the name before the colon) for a node. This is a <var>Unicode</var> string argument; prior to ''Sirius Mods'' version 7.6, this is an EBCDIC string. Its length must be at most 255 characters.</td></tr>
</table>
</table>
==Usage notes==
==Usage notes==
Line 31: Line 31:
<p class="code">...
<p class="code">...
For %i From 1 To 100
For %i From 1 To 100
   If %doc:IsSelectionPrefix('p' With %i) Eq false Then
   If %doc:<var>IsSelectionPrefix</var>('p' With %i) Eq false Then
     Loop End
     Loop End
   End If
   End If
Line 45: Line 45:
<ul>
<ul>
<li>The [[DeleteSelectionPrefix (XmlDoc subroutine)|DeleteSelectionPrefix]] method is useful in
<li>The [[DeleteSelectionPrefix (XmlDoc subroutine)|DeleteSelectionPrefix]] method is useful in
conjunction with IsSelectionPrefix.
conjunction with <var>IsSelectionPrefix</var>.
<li>The [[SelectionNamespace (XmlDoc property)|SelectionNamespace]] method
<li>The [[SelectionNamespace (XmlDoc property)|SelectionNamespace]] method
specifies the namespace URI associated with a prefix, when
specifies the namespace URI associated with a prefix, when
the prefix is used in an XPath expression.
the prefix is used in an XPath expression.
</ul>
</ul>

Revision as of 17:46, 25 January 2011

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


This function 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.

This function is new as of version 7.0 of the Sirius Mods.

Syntax

%boolean = doc:IsSelectionPrefix( prefix)

Syntax terms

%bool A declared enumeration object of type Boolean to contain the returned value (True or False) of IsSelectionPrefix. For more information about enumerations, see Enumerations.
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

This method has no cancellation conditions other than the usual requirement that the method object not be Null.

Example

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

  • The DeleteSelectionPrefix method is useful in conjunction with IsSelectionPrefix.
  • The SelectionNamespace method specifies the namespace URI associated with a prefix, when the prefix is used in an XPath expression.