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

WRITE-DATA-ELEMENT( ) method

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

Syntax

WRITE-DATA-ELEMENT ( name , { chardata | longchar } [ , namespace-URI ]
  [ , SAX-attributes-handle ] )
name
A CHARACTER or LONGCHAR expression evaluating to the fully qualified or unqualified name of the element.
chardata
An expression that evaluates to a CHARACTER variable that contains the XML text.
longchar
An expression that evaluates to a LONGCHAR variable that contains the XML text.
namespace-URI
A CHARACTER or LONGCHAR expression evaluating to the URI of the element, or an empty string ("") or the Unknown value (?).
SAX-attributes-handle
A HANDLE to a SAX-attributes object. The attributes in the SAX-attributes object are added to the new XML element.
Creates a complete XML node. This method call sets the WRITE-STATUS to SAX-WRITE-ELEMENT.
If you use namespace-URI, 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 name contains a prefix and namespace-URI is used, and this call is the first instance of the namespace-URI, then the namespace will be added to the element. This is equivalent to calling the DECLARE-NAMESPACE method. If only the name is used and it contains a prefix, then the SAX-writer attempts to resolve the prefix to a namespace.
This technique is logically equivalent to calling the START-ELEMENT, WRITE-CHARACTERS, and END-ELEMENT methods where name and namespace-URI are the parameters of START-ELEMENT and END-ELEMENT, and chardata is the parameter of WRITE-CHARACTERS.
Note that attributes and namespaces cannot be added after you call this method. If you need to add either to the element, then use the START-ELEMENT method.
If the STRICT attribute is TRUE, the FRAGMENT attribute is FALSE, and the invocation would result in more than one document-level element (that is, root node), then the method fails. Also, if STRICT is TRUE, an external DTD has been declared, and the invocation would create the root node, the name used for the DTD declaration must match the name of the root node or the method fails.

See also

DECLARE-NAMESPACE( ) method