IsSelectionPrefix (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(No difference)

Revision as of 19:44, 31 December 2010

Check if prefix has XPath-selection association

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

  %bool = 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.