IsSelectionPrefix (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
(No difference)

Revision as of 05:27, 25 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.