Prefix (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 41: Line 41:


==Request-cancellation errors==
==Request-cancellation errors==
This list is not exhaustive: it does <i>not</i> include all the errors that are request  cancelling.
<ul>
<ul>
<li><var>XmlDoc</var> <var>Namespace</var> property not <var>On</var>.
<li><var>XmlDoc</var> <var>Namespace</var> property not <var>On</var>.

Revision as of 20:55, 3 March 2014

Prefix part of name of selected node (XmlDoc and XmlNode classes)

Prefix returns the "prefix" (that is, the part of the name before the colon) of the node that is the head of an XPath result.

Syntax

%unicode = nr:Prefix[( [xpath])] Throws XPathError

Syntax terms

%unicode A string variable for the returned prefix.
nr An XmlDoc or XmlNode, used as the context node for the xpath expression. If an XmlDoc, the Root node is the context node.
xpath A Unicode string that is an XPath expression that results in a nodelist. The head of the nodelist is the node to process. An optional argument, its default is a period (.), that is, the node referenced by the method object (nr).

Prior to Sirius Mods Version 7.6, this is an EBCDIC string.

Usage notes

  • The prefix is defined to be:
    • The element-type or attribute name prefix if the node is an Element or Attribute, respectively.
    • The null string, otherwise.
  • This function may only be used if the XmlDoc's Namespace property value is On.

Examples

In the following example, two nodes are added to an XmlDoc and their name prefixes, one of which is the null string, are printed.

begin %d object xmlDoc %d = new %n1 object xmlNode %n1 = %d:addElement('foo:bar', , 'ftp:here') print 'Prefix =' and %n1:prefix %n1 = %n1:addElement('junk') print 'Prefix =' and %n1:prefix end

The example result follows:

Prefix = foo Prefix =

Request-cancellation errors

This list is not exhaustive: it does not include all the errors that are request cancelling.

  • XmlDoc Namespace property not On.
  • The xpath expression is invalid.
  • Result of xpath is empty.
  • Insufficient free space exists in CCATEMP.

See also

  • For more information about using XPath expressions, see "XPath".
  • These methods also obtain information about the name of a node: