QName (XmlDoc/XmlNode function)

From m204wiki
(Redirected from QName (XmlNode function))
Jump to navigation Jump to search

Name (with prefix, if any) of selected node (XmlDoc and XmlNode classes)

QName returns the "fully qualified name" (that is, the entire name as it was specified) of the node that is the head of an XPath result.

Syntax

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

Syntax terms

%unicode A Unicode string variable for the returned name.
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 An XPath expression that results in a nodelist, the head of which is the node to process. Any other nodes in the nodelist are ignored.

This is an optional argument, and its default is a period (.), that is, the node referenced by the method object (nr).

Usage notes

  • The fully qualified name is defined to be:
    • The element-type or attribute name prefix and colon, if there is one, followed by the local name, if the node is an Element or Attribute, respectively.
    • The processing instruction's target, if the node is a PI.
    • Other node types will return the null string.
  • This function may be used with any value of the XmlDoc's Namespace property.
  • As of Sirius Mods Version 7.3, the QName method argument may include only non-null EBCDIC characters that translate to Unicode. As of Sirius Mods Version 7.6, all Janus SOAP string arguments and results are Unicode or are converted to Unicode. For more information about the effects of this Version 7.6 change, see Strings and Unicode with the XmlDoc API.

Example

In the following example, the entire names of both elements are printed:

begin %d object xmlDoc %d = new %n1 object xmlNode %n2 object xmlNode %n1 = %d:addElement('foo:bar', , 'ftp:here') print %n1:qName %n1 = %n1:AddElement('junk') print %n1:qQName end

The example result follows:

foo:bar junk

Request-cancellation errors

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

  • xpath 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: