AppendValue (XmlNode subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 2: Line 2:


This subroutine appends a
This subroutine appends a
Unicode string or a Stringlist object to an XmlNode value.
<var>Unicode</var> string or a <var>Stringlist</var> object to an <var>XmlNode</var> value.


AppendValue is new as of version 7.6 of the ''Sirius Mods''.
<var>AppendValue</var> is new as of version 7.6 of the ''Sirius Mods''.
==Syntax==
==Syntax==
{{Template:XmlNode:AppendValue syntax}}
{{Template:XmlNode:AppendValue syntax}}
Line 10: Line 10:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>nod</th>
<tr><th>nod</th>
<td>An XmlNode that is not the Root node. If it is an Element node, it may have at most one child, and any such child must be a Text node. </td></tr>
<td>An <var>XmlNode</var> that is not the Root node. If it is an Element node, it may have at most one child, and any such child must be a Text node. </td></tr>
<tr><th>value</th>
<tr><th>value</th>
<td>A Unicode string or a Stringlist object.</td></tr>
<td>A <var>Unicode</var> string or a <var>Stringlist</var> object.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>The method argument must be a Unicode string or a Stringlist object:
<li>The method argument must be a <var>Unicode</var> string or a <var>Stringlist</var> object:
<ul>
<ul>
<li>If a Unicode string, the value of the target
<li>If a <var>Unicode</var> string, the value of the target
node is set to its current value followed by the Unicode string.
node is set to its current value followed by the <var>Unicode</var> string.
<li>If a Stringlist object, the value of the target
<li>If a <var>Stringlist</var> object, the value of the target
node is set to its current value followed by the Stringlist items converted
node is set to its current value followed by the <var>Stringlist</var> items converted
from EBCDIC to Unicode, with Unicode linefeed characters between the
from EBCDIC to <var>Unicode</var>, with <var>Unicode</var> linefeed characters between the
Stringlist items.
<var>Stringlist</var> items.
</ul>
</ul>
</ul>
</ul>
Line 30: Line 30:
===Example===
===Example===


The following fragment appends a Unicode string and then a
The following fragment appends a <var>Unicode</var> string and then a
Stringlist to an Element value:
<var>Stringlist</var> to an Element value:
<p class="code">%n = %x:AddElement('a', 'begin value')
<p class="code">%n = %x:AddElement('a', 'begin value')
%n:AppendValue('_some more_')
%n:<var>AppendValue</var>('_some more_')
Text To %sl
Text To %sl
   and more
   and more
   and that's all
   and that's all
End Text
End Text
%n:AppendValue(%sl)
%n:<var>AppendValue</var>(%sl)
%n:Print
%n:Print
</p>
</p>
Line 48: Line 48:
===Request-Cancellation Errors===
===Request-Cancellation Errors===
<ul>
<ul>
<li><i>nod</i> does not point to an XmlNode.
<li><i>nod</i> does not point to an <var>XmlNode</var>.
<li><i>nod</i> points to the Root node.
<li><i>nod</i> points to the Root node.
<li><i>nod</i> points to an Element
<li><i>nod</i> points to an Element
Line 63: Line 63:


<ul>
<ul>
<li>Like AppendValue,
<li>Like <var>AppendValue</var>,
[[AddText (XmlNode function)|AddText]] adds a string to and after a Text node,
[[AddText (XmlNode function)|AddText]] adds a string to and after a Text node,
but only if the [[AdjacentText (XmlDoc property)|AdjacentText]] property is set to <tt>Combine</tt>.
but only if the [[AdjacentText (XmlDoc property)|AdjacentText]] property is set to <tt>Combine</tt>.
</ul>
</ul>

Revision as of 17:46, 25 January 2011

Append to value of node (XmlNode class)

[Requires Janus SOAP]


This subroutine appends a Unicode string or a Stringlist object to an XmlNode value.

AppendValue is new as of version 7.6 of the Sirius Mods.

Syntax

nod:AppendValue( appendedValue)

Syntax terms

nod An XmlNode that is not the Root node. If it is an Element node, it may have at most one child, and any such child must be a Text node.
value A Unicode string or a Stringlist object.

Usage notes

  • The method argument must be a Unicode string or a Stringlist object:
    • If a Unicode string, the value of the target node is set to its current value followed by the Unicode string.
    • If a Stringlist object, the value of the target node is set to its current value followed by the Stringlist items converted from EBCDIC to Unicode, with Unicode linefeed characters between the Stringlist items.

Example

The following fragment appends a Unicode string and then a Stringlist to an Element value:

%n = %x:AddElement('a', 'begin value') %n:AppendValue('_some more_') Text To %sl and more and that's all End Text %n:AppendValue(%sl) %n:Print

The result is:

<a>begin value_some more_and more&#xA;and that's all</a>

Request-Cancellation Errors

  • nod does not point to an XmlNode.
  • nod points to the Root node.
  • nod points to an Element node that has more than one child, or that has one, non-Text node child.
  • value violates the rules for XML Element content (that is, it contains an invalid character).
  • Insufficient free space exists in CCATEMP.


See also

  • Like AppendValue, AddText adds a string to and after a Text node, but only if the AdjacentText property is set to Combine.