AdjacentText (XmlDoc property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (edits, tags and links)
(No difference)

Revision as of 11:08, 4 May 2011

Are adjacent text nodes allowed? (XmlDoc class)

This property indicates whether or not an operation is allowed that places text nodes adjacent to each other in an XmlDoc.

Syntax

%currentXmlAdjacentTextSetting = doc:AdjacentText doc:AdjacentText = newXmlAdjacentTextSetting

Syntax terms

%currentXmlAdjacentTextSetting The AdjacentTextSetting enumeration value of doc's AdjacentText property. For more information about this enumeration, see "Usage Notes" below.
doc An XmlDoc object expression.
newXmlAdjacentTextSetting The AdjacentTextSetting value (see below) to assign to doc's AdjacentText property.

Usage notes

  • The values of the AdjacentText property are of type Enumeration AdjacentText Setting. These values and their meanings are shown below. For more information about enumerations, see Enumerations.
    Combine
    This setting permits without request cancellation the following operations that place text nodes adjacent to each other:
    • DeleteSubtree applied to a subtree that is between Text nodes
    • AddText applied to an Element whose last child is a Text node
    • InsertTextBefore applied to a Text node or to the sibling following a Text node
    • AddSubtree with a Text node source subtree applied to a target Element that has a Text node as its last child
    • InsertSubtreeBefore with a Text node source subtree applied to a target that is a Text node or a target that is the sibling following a Text node

    If one of these operations occurs, the values of the adjacent Text nodes are combined to form a new Text node. The new node takes the place of the former Text node(s), and the former is (are) deleted. Any XmlNode or XmlNodelist pointers to the former Text node(s) are set to Null.

    Disallow
    This is the initial value of the AdjacentText property. With this setting, the operations cited above for Combine result in request cancellation, since they place text nodes adjacent to each other.
  • AdjacentText is available in "Sirius Mods" Version 6.7 and later.

Examples

  1. The following example obtains the string value of the AdjacentText property:

    %str = %doc:AdjacentText:toString

  2. The following request shows the effect of using the Combine option forming a new node, making pointers Null:

    begin %d object xmlDoc auto new %d:adjacentText = Combine %e object xmlNode %t object xmlNode %t2 object xmlNode %t3 object xmlNode %e = %d:addElement('topElement') %t = %e:addText('Texta.') Call %e:addText('Textb.') if %t is null then print 'First now Null' end if %d:print %t = %e:selectSingleNode('node()') print 'Value of first child node:' and %t:value %t2 = %e:addElement('subElement') %t3 = %e:addText('Textc.') Call %t2:deleteSubtree if %t is null then print 'First now Null' end if if %t3 is null then print 'Last now Null' end if %d:print %t = %e:selectSingleNode('node()') print 'Value of first child node:' and %t:value end

    The result of the above request is:

    First now Null <topElement>Texta.Textb.</topElement> Value of first child node: Texta.Textb. First now Null Last now Null <topElement>Texta.Textb.Textc.</topElement> Value of first child node: Texta.Textb.Textc.

Request-Cancellation Errors (for set method)

  • newvalue is an invalid value.

See also