Write XML from a temp-table buffer's current row
- Last Updated: June 7, 2019
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Syntax
The SERIALIZE-ROW( ) method serializes a
buffer's current row to an XML string.
The syntax
for SERIALIZE-ROW( ) is shown below. The
method returns TRUE or FALSE to
indicate whether the operation was successful.
|
- target-format
- A
CHARACTERexpression that specifies the target format used to serialize the current row. Valid values are"JSON"and"XML". However, this method description focuses on serializing to an XML string. - target-type
- A
CHARACTERexpression that specifies the target type for the XML string. Valid values are:"FILE","STREAM","MEMPTR","HANDLE", and"LONGCHAR". - file
- A
CHARACTERexpression that specifies the name of a file to which the AVM writes the XML string. You can specify an absolute pathname or a pathname relative to the current working directory. If a file with the specified name already exists, the AVM verifies that the file is writeable and overwrites the file. - stream
- A
CHARACTERexpression that specifies the name of a stream. If you specify the empty string (""), the AVM writes the XML string to the default unnamed output stream. For WebSpeed, write the XML string to the WebSpeed-defined output stream (WEBSTREAM). - stream-handle
- A
HANDLEvariable that specifies a stream object handle. - memptr
- A
MEMPTRvariable to contain the XML string in memory. If you do not specify the encoding parameter, the AVM encodes the text written to theMEMPTRasUTF-8. This method allocates the required amount of memory for the XML string and sets the size of the variable. When you are finished using theMEMPTR, you must free the associated memory, by setting theMEMTERto zero bytes with theSET-SIZEstatement. - longchar
- A
LONGCHARvariable to contain the XML string in memory. - JsonObject
- A reference to a
Progress.Json.ObjectModel.JsonObjectobject. - formatted
- An optional
LOGICALexpression whereTRUEdirects the AVM to format the XML string in a hierarchical manner using extra white space, carriage returns, and line feeds. The default value isFALSE. If you specify the Unknown value (?), the method uses the default value ofFALSE. - encoding
- An optional
CHARACTERexpression that specifies the name of the character encoding the AVM uses to write the XML string. The default encoding is "UTF-8". - omit-initial-values
- An optional
LOGICALexpression whereTRUEdirects the AVM to exclude temp-table fields containing their initial values from the XML string, andFALSEdirects the AVM to include all temp-table field data in the XML. The default value isFALSE. If you specify the Unknown value (?), the method uses the default value ofFALSE. - omit-outer-object
- This argument is not valid when target-format is
"XML". If set toTRUE,SERIALIZE-ROW( )generates an error message and returnsFALSE.
The following example demonstrates the use of SERIALIZE-ROW( ) to produce XML output.
|
The XML output that SERIALIZE-ROW( )
produces in bcust.xml follows.
|