NoEmptyElement (XmlNode property): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
<span style="font-size:120%; color:black"><b>(Dis)allow empty-element tags for childless nodes in serialization</b></span>
{{Template:XmlNode:NoEmptyElement subtitle}}
[[Category:XmlNode methods|NoEmptyElement property]]
[[Category:XmlNode methods|NoEmptyElement property]]
[[Category:XmlDoc API methods]]
[[Category:XmlDoc API methods]]
Line 20: Line 20:


NoEmptyElement is new as of version 7.6 of the ''Sirius Mods''.
NoEmptyElement is new as of version 7.6 of the ''Sirius Mods''.
===Syntax===
==Syntax==
  %bool = doc:NoEmptyElement
{{Template:XmlNode:NoEmptyElement syntax}}
 
===Syntax terms===
  doc:NoEmptyElement = %bool
 
====Syntax Terms====
<dl>
<dl>
<dt>%bool
<dt>%bool
Line 35: Line 32:
</dl>
</dl>


===Usage Notes===
==Usage notes==
<ul>
<ul>
<li>NoEmptyElement can be useful if you are using the [[Janus SOAP ULI]] to
<li>NoEmptyElement can be useful if you are using the [[Janus SOAP ULI]] to
Line 43: Line 40:
and for other childless elements they work correctly only if there are
and for other childless elements they work correctly only if there are
separate start and end tags.
separate start and end tags.
Because of this inconsistency, you cannot obtain a &ldquo;blanket&rdquo; suppression
Because of this inconsistency, you cannot obtain a "blanket" suppression
of empty element tags via using the <tt>NoEmptyElt</tt> option of the
of empty element tags via using the <tt>NoEmptyElt</tt> option of the
serialization methods (for example, see [[??]] refid=noempty.).
serialization methods (for example, see [[??]] refid=noempty.).
</ul>
</ul>
===Examples===
==Examples==


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:

Revision as of 16:58, 22 January 2011

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

NoEmptyElement is a member of the XmlNode class.

This property 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.

NoEmptyElement is new as of version 7.6 of the Sirius Mods.

Syntax

%currentBoolean = nod:NoEmptyElement nod:NoEmptyElement = newBoolean

Syntax terms

%bool
The Boolean enumeration value of nod's NoEmptyElement property. For more information about these enumerations, see Using Boolean enumerations.
nod
An XmlNode object expression.

Usage notes

  • NoEmptyElement can be useful if you are using the Janus SOAP ULI 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 ?? refid=noempty.).

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.