Prefix (XmlDoc/XmlNode function): Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{Template:XmlDoc/XmlNode:Prefix subtitle}} | |||
[[Category:XmlDoc methods|Prefix function]] | [[Category:XmlDoc methods|Prefix function]] | ||
[[Category:XmlNode methods|Prefix function]] | [[Category:XmlNode methods|Prefix function]] | ||
Line 11: | Line 11: | ||
</p> | </p> | ||
This function gets the | This function gets the "prefix" (that is, the part of the name | ||
before the colon) of the node that is the head of an XPath result. | before the colon) of the node that is the head of an XPath result. | ||
==Syntax== | |||
{{Template:XmlDoc/XmlNode:Prefix syntax}} | |||
===Syntax terms=== | |||
<dl> | <dl> | ||
<dt>%pref | <dt>%pref | ||
Line 33: | Line 33: | ||
</dl> | </dl> | ||
==Usage notes== | |||
<ul> | <ul> | ||
<li>The prefix is defined to be: | <li>The prefix is defined to be: |
Revision as of 16:57, 22 January 2011
Prefix part of name of selected node (XmlDoc and XmlNode classes)
Prefix is a member of the XmlDoc and XmlNode classes.
This function gets 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
- %pref
- 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 is On.
Example
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
- XmlDoc Namespace property not On.
- XPath is invalid.
- Result of (XPath) is empty.
- Insufficient free space exists in CCATEMP.