NoEmptyElement (XmlNode property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
{{Template:XmlNode:NoEmptyElement subtitle}}
{{Template:XmlNode:NoEmptyElement subtitle}}
<var>NoEmptyElement</var> indicates whether or not to serialize the method object <var>XmlNode</var> with a separate start tag and end tag instead of with a single empty-element tag ''if the node is childless''.  A [[Enumerations#Using Boolean enumerations|Boolean]] value of <code>True</code> serializes with a separate start tag and end tag (for example, <code><address></address></code> versus <code><address/></code>).  The default value, <code>False</code>, serializes childless nodes in the usual way, that is, with an empty-element tag.
<var>NoEmptyElement</var> indicates whether or not to serialize the method object <var>XmlNode</var> with a separate start tag and end tag instead of with a single empty-element tag ''if the node is childless''.  A <var>[[Enumerations#Using Boolean enumerations|Boolean]]</var> value of <var>True</var> serializes with a separate start tag and end tag (for example, <code><address></address></code> versus <code><address/></code>).  The default value, <var>False</var>, serializes childless nodes in the usual way, that is, with an empty-element tag.
<p><var>NoEmptyElement</var> may be specified for any <var>Element</var> node.</p>
<p><var>NoEmptyElement</var> may be specified for any <var>Element</var> node.</p>


Line 8: Line 8:
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%currentBoolean</th>
<tr><th>%currentBoolean</th>
<td>The <var>Boolean</var> enumeration value of <var class="term">nod</var>'s <var>NoEmptyElement</var> property. For more information about these enumerations, see [[Enumerations#Using_Boolean_enumerations|"Using Boolean Enumerations"]]. </td></tr>
<td>The <var>Boolean</var> enumeration value of object <var class="term">nod</var>'s <var>NoEmptyElement</var> property. </td></tr>
<tr><th>nod</th>
<tr><th>nod</th>
<td>An <var>XmlNode</var> object expression.</td></tr>
<td>An <var>XmlNode</var> object expression.</td></tr>
<tr><th>newBoolean</th>
<tr><th>newBoolean</th>
<td>The <var>Boolean</var> value to assign to <var class="term">doc</var>'s <var>NoEmptyElement</var> property.</td></tr>
<td>The <var>Boolean</var> value to set for <var class="term">nod</var>'s <var>NoEmptyElement</var> property.</td></tr>
</table>
</table>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li><var>NoEmptyElement</var> can be useful if you are using the <var class="product">[[Janus_SOAP_User_Language_Interface|"Janus SOAP User Language Interface"]]</var> to generate XHTML.  Tests show that some browsers work correctly for certain childless elements only if they have an empty element tag, and for other childless elements they work correctly only if there are separate start and end tags.  Because of this inconsistency, you cannot obtain a "blanket" suppression of empty element tags via using the <code>NoEmptyElt</code> option of the serialization methods (for example, see the <var>[[Serial_(XmlDoc/XmlNode_function)#Syntax_terms|"Serial method: syntax terms"]]</var>).  
<li><var>NoEmptyElement</var> can be useful if you are using the <var class="product">[[Janus SOAP User Language Interface]]</var> to generate XHTML.  Tests show that some browsers work correctly for certain childless elements only if they have an empty element tag, and for other childless elements they work correctly only if there are separate start and end tags.  Because of this inconsistency, you cannot obtain a "blanket" suppression of empty element tags via using the <var>NoEmptyElt</var> option of the serialization methods (for example, see the <var>[[Serial_(XmlDoc/XmlNode_function)#noempty|Serial]]</var> method).  
<li><var>NoEmptyElement</var> is available in <var class="product">[[Sirius Mods]]</var> Version 7.6 and later.
<li><var>NoEmptyElement</var> is available in <var class="product">[[Sirius Mods]]</var> Version 7.6 and later.
</ul>
</ul>


==Examples==
==Examples==
<ol><li>
The node in the following fragment is serialized with a start and end tag:
The node in the following fragment is serialized with a start and end tag:
<p class="code">%texta = %form:[[AddElement_(XmlDoc/XmlNode_function)|addElement]]('textArea')
<p class="code">%texta = %form:[[AddElement_(XmlDoc/XmlNode_function)|addElement]]('textArea')
Line 33: Line 32:
The result is:
The result is:
<p class="output"><textArea name="foo" rows="15" cols="40"></textArea>
<p class="output"><textArea name="foo" rows="15" cols="40"></textArea>
</p></ol>
</p>


==Request-Cancellation Errors (for set method)==
==Request-cancellation errors (for set method)==
<ul>
<ul>
<li><var class="term">%bool</var> is an invalid value.
<li>The <var class="term">newBoolean</var> setting is an invalid value.
</ul>
</ul>


==See also==
==See also==
{{Template:XmlNode:NoEmptyElement footer}}
{{Template:XmlNode:NoEmptyElement footer}}

Revision as of 20:13, 3 June 2011

Suppress/produce empty tag when serializing this Element, if childless (XmlNode class)

NoEmptyElement indicates whether or not to serialize the method object XmlNode with a separate start tag and end tag instead of with a single empty-element tag if the node is childless. A Boolean value of True serializes with a separate start tag and end tag (for example, <address></address> versus <address/>). The default value, False, serializes childless nodes in the usual way, that is, with an empty-element tag.

NoEmptyElement may be specified for any Element node.

Syntax

%currentBoolean = nod:NoEmptyElement nod:NoEmptyElement = newBoolean

Syntax terms

%currentBoolean The Boolean enumeration value of object nod's NoEmptyElement property.
nod An XmlNode object expression.
newBoolean The Boolean value to set for nod's NoEmptyElement property.

Usage notes

  • NoEmptyElement can be useful if you are using the Janus SOAP User Language Interface to generate XHTML. Tests show that some browsers work correctly for certain childless elements only if they have an empty element tag, and for other childless elements they work correctly only if there are separate start and end tags. Because of this inconsistency, you cannot obtain a "blanket" suppression of empty element tags via using the NoEmptyElt option of the serialization methods (for example, see the Serial method).
  • NoEmptyElement is available in Sirius Mods Version 7.6 and later.

Examples

The node in the following fragment is serialized with a start and end tag:

%texta = %form:addElement('textArea') %texta:noEmptyElement = True %texta:addAttribute('name', 'foo') %texta:addAttribute('rows', '15') %texta:addAttribute('cols', '40') %texta:print

The result is:

<textArea name="foo" rows="15" cols="40"></textArea>

Request-cancellation errors (for set method)

  • The newBoolean setting is an invalid value.

See also