Try OpenEdge Now
skip to main content
ABL Reference
Handle Attributes and Methods Reference : WRITE-EMPTY-ELEMENT( ) method
 

WRITE-EMPTY-ELEMENT( ) method

Creates an empty XML node in a SAX-writer object.
Return type: LOGICAL
Applies to: SAX-writer object handle

Syntax

WRITE-EMPTY-ELEMENT ( name [ , namespace-URI ]
[ , SAX-attributes-handle ] )
name
A CHARACTER or LONGCHAR expression evaluating to the fully qualified or unqualified name of the element.
namespace-URI
A CHARACTER or LONGCHAR expression evaluating to the URI of the element, or an empty string ("") or the Unknown value (?) if the element doesn't contain a namespace.
SAX-attributes-handle
A HANDLE to a SAX-attributes object. The attributes in the SAX-attributes object are added to the new empty XML element.
Creates an empty XML node. This method call sets the WRITE-STATUS to SAX-WRITE-TAG.
If namespace-URI is present, then the prefix is resolved in the following order:
1. The method attempts to extract the namespace from the name.
2. The method attempts to extract the namespace from a previously declared namespace.
3. The method attempts to generate the default namespace.
If the name contains a prefix, namespace-URI is present, and this is the first instance of the namespace-URI then the namespace is added to the element. This is equivalent to calling the DECLARE-NAMESPACE method.
If only the name is present and it contains a prefix, then the SAX-writer attempts to resolve the prefix to a namespace.
Although this method call appears to be logically equivalent to a START-ELEMENT invocation directly followed by its corresponding END-ELEMENT invocation, the two techniques produce different outputs. The START-ELEMENT and END-ELEMENT methods produce a pair of tags; <element></element>. WRITE-EMPTY-ELEMENT produces the empty element tag; <element/>.
If the SAX-attributes-handle is supplied, the attributes will be written after the name of the element, in the order that they are indexed in the SAX-attributes object. If they contain namespace information, then that information will be handled as if the attribute were added using INSERT-ATTRIBUTE( ) method.
If STRICT is TRUE, FRAGMENT is FALSE, and the invocation would result in more than one document-level element, (that is, root node), then the method fails.