AppendValue (XmlNode subroutine): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 26: Line 26:
<p class="code">%n = %x:[[AddElement_(XmlDoc/XmlNode_function)|addElement]]('a', 'begin value')
<p class="code">%n = %x:[[AddElement_(XmlDoc/XmlNode_function)|addElement]]('a', 'begin value')
%n:appendValue('_some more_')
%n:appendValue('_some more_')
[[Text_and_Html_statements#The_HTML_or_TEXT_statement|text to]] %sl
[[Text_and_Html_statements#toOption|text to]] %sl
   and more
   and more
   and that's all
   and that's all
Line 38: Line 38:


==Request-cancellation errors==
==Request-cancellation errors==
This list is not exhaustive: it does <i>not</i> include all the errors that are request cancelling.
<ul>
<ul>
<li>The <var class="term">nod</var> argument does not point to an <var>XmlNode</var>.
<li>The <var class="term">nod</var> argument does not point to an <var>XmlNode</var>.

Latest revision as of 18:48, 1 September 2015

Append to value of node (XmlNode class)

[Requires Janus SOAP]

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

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.
appendedValue 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.
  • AppendValue is available in Sirius Mods Version 7.6 and later.

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

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

  • The nod argument 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.
  • The appendedValue argument violates the rules for XML Element content (that is, it contains an invalid character).
  • Insufficient free space exists in CCATEMP.

See also

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