NoEmptyElement (XmlNode property): Difference between revisions
m (1 revision) |
m (1 revision) |
||
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 [[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 [[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. | ||
<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> | ||
Revision as of 20:31, 24 May 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 nod's NoEmptyElement property. For more information about these enumerations, see "Using Boolean Enumerations". |
---|---|
nod | An XmlNode object expression. |
newBoolean | The Boolean value to assign to doc'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: syntax terms"). - 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)
- %bool is an invalid value.