QName (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 9: Line 9:
<dl>
<dl>
<dt>%name
<dt>%name
<dd>A Unicode string variable for the returned name.
<dd>A <var>Unicode</var> string variable for the returned name.
<dt>nr
<dt>nr
<dd>An XmlDoc or XmlNode, used as the context node for the
<dd>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the
<i>XPath</i> expression.
<i>XPath</i> expression.
If an XmlDoc, the Root node is the context node.
If an <var>XmlDoc</var>, the Root node is the context node.
<dt>XPath
<dt>XPath
<dd>An XPath expression which results in a nodelist, the head of which is
<dd>An XPath expression which results in a nodelist, the head of which is
Line 33: Line 33:
</ul>
</ul>
<li>This function may be used with any value of the
<li>This function may be used with any value of the
XmlDoc's Namespace property.
<var>XmlDoc</var>'s Namespace property.
<li>As of ''Sirius Mods'' version 7.3, the QName method argument may
<li>As of ''Sirius Mods'' version 7.3, the <var>QName</var> method argument may
include only non-null EBCDIC characters that translate to Unicode.
include only non-null EBCDIC characters that translate to <var>Unicode</var>.
As of ''Sirius Mods'' version 7.6, all [[Janus SOAP]] string arguments and results are Unicode
As of ''Sirius Mods'' version 7.6, all [[Janus SOAP]] string arguments and results are <var>Unicode</var>
or are converted to Unicode.
or are converted to <var>Unicode</var>.
For more information about the effects of this version 7.6
For more information about the effects of this version 7.6
change, see [[Strings and Unicode]].
change, see [[Strings and Unicode]].
Line 46: Line 46:
In the following example, the entire names of both elements are printed:
In the following example, the entire names of both elements are printed:
<p class="code">Begin
<p class="code">Begin
%d Object XmlDoc
%d <var>Object</var> <var>XmlDoc</var>
%d = New
%d = New
%n1 Object XmlNode
%n1 <var>Object</var> <var>XmlNode</var>
%n2 Object XmlNode
%n2 <var>Object</var> <var>XmlNode</var>
%n1 = %d:AddElement('foo:bar', , 'ftp:here')
%n1 = %d:AddElement('foo:bar', , 'ftp:here')
Print %n1:QName
Print %n1:<var>QName</var>
%n1 = %n1:AddElement('junk')
%n1 = %n1:AddElement('junk')
Print %n1:QName
Print %n1:<var>QName</var>
End
End
</p>
</p>

Revision as of 17:46, 25 January 2011

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


This function gets 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

%name
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 which results in a nodelist, the head of which is the node to process. An optional argument, 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.

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:QName End

The example result follows:

foo:bar junk

Request-Cancellation Errors

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