AdjacentText (XmlDoc property): Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 3: | Line 3: | ||
This property indicates whether or not | This property indicates whether or not | ||
an operation is allowed that places text nodes adjacent to each other | an operation is allowed that places text nodes adjacent to each other | ||
in an XmlDoc. | in an <var>XmlDoc</var>. | ||
==Syntax== | ==Syntax== | ||
{{Template:XmlDoc:AdjacentText syntax}} | {{Template:XmlDoc:AdjacentText syntax}} | ||
Line 9: | Line 9: | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>%curr</th> | <tr><th>%curr</th> | ||
<td>The | <td>The <var>AdjacentText</var>Setting enumeration value of <i>doc</i>'s <var>AdjacentText</var> property. For more information about this enumeration, see [[??]] reftxt='Usage Notes' refid=unadjtx., below. </td></tr> | ||
<tr><th>doc</th> | <tr><th>doc</th> | ||
<td>An XmlDoc object expression. </td></tr> | <td>An <var>XmlDoc</var> object expression. </td></tr> | ||
<tr><th>newvalue</th> | <tr><th>newvalue</th> | ||
<td>The | <td>The <var>AdjacentText</var>Setting value (see below) to assign to <i>doc</i>'s <var>AdjacentText</var> property.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | ==Usage notes== | ||
<ul> | <ul> | ||
<li>The values of the AdjacentText property are of | <li>The values of the <var>AdjacentText</var> property are of | ||
type Enumeration | type Enumeration <var>AdjacentText</var>Setting. | ||
These values and their meanings are shown below. | These values and their meanings are shown below. | ||
For more information about enumerations, see [[Enumerations]]. | For more information about enumerations, see [[Enumerations]]. | ||
Line 44: | Line 44: | ||
The new node takes the place of the former Text node(s), | The new node takes the place of the former Text node(s), | ||
and the former is (are) deleted. | and the former is (are) deleted. | ||
Any XmlNode or XmlNodelist pointers to the former Text node(s) | Any <var>XmlNode</var> or <var>XmlNodelist</var> pointers to the former Text node(s) | ||
are set to Null. | are set to Null. | ||
<dt>Disallow | <dt>Disallow | ||
<dd>This is the initial value of the AdjacentText property. | <dd>This is the initial value of the <var>AdjacentText</var> property. | ||
With this setting, the operations cited above for <tt>Combine</tt> | With this setting, the operations cited above for <tt>Combine</tt> | ||
result in request cancellation, since they place | result in request cancellation, since they place | ||
Line 56: | Line 56: | ||
==Examples== | ==Examples== | ||
<ul> | <ul> | ||
<li>The following example obtains the string value of the AdjacentText property: | <li>The following example obtains the string value of the <var>AdjacentText</var> property: | ||
<p class="code">%str = %doc:AdjacentText: | <p class="code">%str = %doc:<var>AdjacentText</var>:To<var>String</var> | ||
</p> | </p> | ||
<li>The following request shows the effect of using the Combine option: | <li>The following request shows the effect of using the Combine option: | ||
forming a new node, making pointers Null. | forming a new node, making pointers Null. | ||
<p class="code">Begin | <p class="code">Begin | ||
%d Object XmlDoc Auto New | %d <var>Object</var> <var>XmlDoc</var> Auto New | ||
%d:AdjacentText = Combine | %d:<var>AdjacentText</var> = Combine | ||
%e Object XmlNode | %e <var>Object</var> <var>XmlNode</var> | ||
%t Object XmlNode | %t <var>Object</var> <var>XmlNode</var> | ||
%t2 Object XmlNode | %t2 <var>Object</var> <var>XmlNode</var> | ||
%t3 Object XmlNode | %t3 <var>Object</var> <var>XmlNode</var> | ||
%e = %d:AddElement('topElement') | %e = %d:AddElement('topElement') |
Revision as of 17:46, 25 January 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
%curr | The AdjacentTextSetting enumeration value of doc's AdjacentText property. For more information about this enumeration, see ?? reftxt='Usage Notes' refid=unadjtx., below. |
---|---|
doc | An XmlDoc object expression. |
newvalue | The AdjacentTextSetting value (see below) to assign to doc's AdjacentText property. |
Usage notes
- The values of the AdjacentText property are of
type Enumeration AdjacentTextSetting.
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.
- This method is new in Sirius Mods version 6.7.
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)
- newvalue is an invalid value.