AdjacentText (XmlDoc property): Difference between revisions
m (→Usage notes) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:XmlDoc:AdjacentText subtitle}} | {{Template:XmlDoc:AdjacentText subtitle}} | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc:AdjacentText syntax}} | {{Template:XmlDoc:AdjacentText syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%currentXmlAdjacentTextSetting</th> | <tr><th nowrap>%currentXmlAdjacentTextSetting</th> | ||
<td>The <var> | <td>The <var>XmlAdjacentTextSetting</var> enumeration value (see below) of <var class="term">doc</var>'s <var>AdjacentText</var> property. </td></tr> | ||
<tr><th>doc</th> | <tr><th>doc</th> | ||
<td>An <var>XmlDoc</var> object expression.</td></tr> | <td>An <var>XmlDoc</var> object expression.</td></tr> | ||
<tr><th>newXmlAdjacentTextSetting</th> | <tr><th>newXmlAdjacentTextSetting</th> | ||
<td>The <var> | <td>The <var>XmlAdjacentTextSetting</var> value (see below) to assign to <var class="term">doc</var>'s <var>AdjacentText</var> property.</td></tr> | ||
</table> | </table> | ||
== | ===XmlAdjacentTextSetting enumeration=== | ||
The values of the <var>AdjacentText</var> property are of type <var>[[Enumerations|Enumeration]]</var> <var>XmlAdjacentTextSetting</var>. These values and their meanings are shown below. | |||
<dl> | <dl> | ||
<dt><b>Combine</b> | <dt><b>Combine</b> | ||
<dd>This setting permits without request cancellation the following operations that place text nodes adjacent to each other: | <dd>This setting permits without request cancellation the following operations that place text nodes adjacent to each other: | ||
<ul> | <ul> | ||
<li><var>[[DeleteSubtree_(XmlDoc/XmlNode_subroutine)|DeleteSubtree]]</var> applied to a subtree that is between | <li><var>[[DeleteSubtree_(XmlDoc/XmlNode_subroutine)|DeleteSubtree]]</var> applied to a subtree that is between [[XmlDoc API#XmlDoc node types|Text nodes]] | ||
<li><var>[[AddText_(XmlNode_function)|AddText]]</var> applied to an <var>Element</var> whose last child is a <var>Text</var> node | <li><var>[[AddText_(XmlNode_function)|AddText]]</var> applied to an <var>Element</var> whose last child is a <var>Text</var> node | ||
<li><var>[[InsertTextBefore_(XmlNode_function)|InsertTextBefore]]</var> applied to a <var>Text</var> node or to the sibling following a <var>Text</var> node | <li><var>[[InsertTextBefore_(XmlNode_function)|InsertTextBefore]]</var> applied to a <var>Text</var> node or to the sibling following a <var>Text</var> node | ||
<li><var>[[AddSubtree_(XmlDoc/XmlNode_function)|AddSubtree]]</var> with a <var>Text</var> node source subtree applied to a target <var>Element</var> that has a <var>Text</var> node as its last child | <li><var>[[AddSubtree_(XmlDoc/XmlNode_function)|AddSubtree]]</var> with a <var>Text</var> node source subtree applied to a target <var>Element</var> that has a <var>Text</var> node as its last child | ||
<li><var>[[InsertSubtreeBefore_(XmlNode_function)|InsertSubtreeBefore]]</var> with a <var>Text</var> node source subtree applied to a target that is a <var>Text</var> node or a target that is the sibling following a <var>Text</var> node | <li><var>[[InsertSubtreeBefore_(XmlNode_function)|InsertSubtreeBefore]]</var> with a <var>Text</var> node source subtree applied to a target that is a <var>Text</var> node or a target that is the sibling following a <var>Text</var> node | ||
</ul> | </ul> | ||
If one of these operations occurs, the values of the adjacent <var>Text</var> nodes are combined to form a new <var>Text</var> node. The new node takes the place of the former <var>Text</var> node(s), and the former is (are) deleted. Any <var>XmlNode</var> or <var>XmlNodelist</var> pointers to the former <var>Text</var> node(s) are set to Null. | |||
If one of these operations occurs, the values of the adjacent <var>Text</var> nodes are combined to form a new <var>Text</var> node. The new node takes the place of the former <var>Text</var> node(s), and the former is (are) deleted. Any <var>XmlNode</var> or <var>XmlNodelist</var> pointers to the former <var>Text</var> node(s) are set to <var>Null</var>. | |||
<dt><b>Disallow</b> | <dt><b>Disallow</b> | ||
<dd>This is the initial value of the <var>AdjacentText</var> property. With this setting, the operations cited above for < | <dd>This is the initial value of the <var>AdjacentText</var> property. With this setting, the operations cited above for <var>Combine</var> result in request cancellation, since they place <var>Text</var> nodes adjacent to each other. | ||
</dl> | </dl> | ||
</ | |||
<p class="note">'''Note:''' As with all enumerations, the <var>ToString</var> method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see [[Enumerations#Common enumeration methods|Common enumeration methods]]. </p> | |||
==Examples== | ==Examples== | ||
Line 82: | Line 86: | ||
</ol> | </ol> | ||
==Request- | ==Request-cancellation errors (for set method)== | ||
This list is not exhaustive: it does <i>not</i> include all the errors that are request cancelling. | |||
<ul> | <ul> | ||
<li><var class="term"> | <li>The <var class="term">newXmlAdjacentTextSetting</var> argument is an invalid value. | ||
</ul> | </ul> | ||
==See also== | ==See also== | ||
{{Template:XmlDoc:AdjacentText footer}} | {{Template:XmlDoc:AdjacentText footer}} |
Latest revision as of 21:01, 2 September 2015
Are adjacent text nodes allowed? (XmlDoc class)
Syntax
%currentXmlAdjacentTextSetting = doc:AdjacentText doc:AdjacentText = newXmlAdjacentTextSetting
Syntax terms
%currentXmlAdjacentTextSetting | The XmlAdjacentTextSetting enumeration value (see below) of doc's AdjacentText property. |
---|---|
doc | An XmlDoc object expression. |
newXmlAdjacentTextSetting | The XmlAdjacentTextSetting value (see below) to assign to doc's AdjacentText property. |
XmlAdjacentTextSetting enumeration
The values of the AdjacentText property are of type Enumeration XmlAdjacentTextSetting. These values and their meanings are shown below.
- 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.
Note: As with all enumerations, the ToString method implicitly converts an enumeration value to a character string whose value is the name of the enumeration value. For more information about methods available to all enumerations, see Common enumeration methods.
Examples
- The following example obtains the string value of the AdjacentText property:
%str = %doc:AdjacentText:toString
- 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)
This list is not exhaustive: it does not include all the errors that are request cancelling.
- The newXmlAdjacentTextSetting argument is an invalid value.