QName (XmlDoc/XmlNode function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
m (move footer template to actual end; edits, tags and links)
Line 1: Line 1:
{{Template:XmlDoc/XmlNode:QName subtitle}}
{{Template:XmlDoc/XmlNode:QName subtitle}}
<var>QName</var> 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.


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==
==Syntax==
{{Template:XmlDoc/XmlNode:QName syntax}}
{{Template:XmlDoc/XmlNode:QName syntax}}
Line 9: Line 7:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%unicode</th>
<tr><th>%unicode</th>
<td>A <var>Unicode</var> string variable for the returned name. </td></tr>
<td>A <var>Unicode</var> string variable for the returned name.</td></tr>
<tr><th>nr</th>
<tr><th>nr</th>
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var class="term">xpath</var> expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node. </td></tr>
<td>An <var>XmlDoc</var> or <var>XmlNode</var>, used as the context node for the <var class="term">xpath</var> expression. If an <var>XmlDoc</var>, the <var>Root</var> node is the context node.</td></tr>
<tr><th>xpath</th>
<tr><th>xpath</th>
<td>An [[XPath#XPath_syntax|XPath expression]] that results in a nodelist, the head of which is the node to process. An optional argument, its default is a period (<tt>.</tt>), that is, the node referenced by the method object (<var class="term">nr</var>).</td></tr>
<td>An [[XPath#XPath_syntax|XPath expression]] that results in a <var>nodelist</var>, the head of which is the node to process. An optional argument, its default is a period (<code>.</code>), that is, the node referenced by the method object (<var class="term">nr</var>).</td></tr>
</table>
</table>


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


==Example==
==Example==
 
<ol><li>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_(XmlDoc/XmlNode_function)|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:qQName
Print %n1:<var>QName</var>
end
End
</p>
</p>
The example result follows:
The example result follows:
<p class="output">foo:bar
<p class="output">foo:bar
junk
junk
</p>
</p></ol>


==Request-Cancellation Errors==
==Request-Cancellation Errors==
Line 62: Line 50:
<li>Insufficient free space exists in CCATEMP.
<li>Insufficient free space exists in CCATEMP.
</ul>
</ul>


==See also==
==See also==
{{Template:XmlDoc/XmlNode:QName footer}}
<ul>
<ul>
<li>For more information about using XPath expressions, see [[XPath|"XPath"]].
<li>For more information about using XPath expressions, see [[XPath|"XPath"]].
Line 75: Line 61:
</ul>
</ul>
</ul>
</ul>
{{Template:XmlDoc/XmlNode:QName footer}}

Revision as of 03:45, 29 May 2011

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. 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 with the XmlDoc API".

Example

  1. 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

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