IsSelectionPrefix (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>Check if prefix has XPath-selection association</b></span>
{{Template:XmlDoc:IsSelectionPrefix subtitle}}
[[Category:XmlDoc methods|IsSelectionPrefix function]]
[[Category:XmlDoc methods|IsSelectionPrefix function]]
[[Category:XmlDoc API methods]]
[[Category:XmlDoc API methods]]
Line 17: Line 17:


This function is new as of version 7.0 of the ''Sirius Mods''.
This function is new as of version 7.0 of the ''Sirius Mods''.
===Syntax===
==Syntax==
  %bool = doc:IsSelectionPrefix(prefix)
{{Template:XmlDoc:IsSelectionPrefix syntax}}
 
===Syntax terms===
====Syntax Terms====
<dl>
<dl>
<dt><i><b>%bool</b></i>
<dt><i><b>%bool</b></i>
Line 34: Line 33:
Its length must be at most 255 characters.
Its length must be at most 255 characters.
</dl>
</dl>
===Usage Notes===
==Usage notes==


This method has no cancellation conditions other than the usual requirement
This method has no cancellation conditions other than the usual requirement

Revision as of 16:58, 22 January 2011

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

IsSelectionPrefix is a member of the 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.