Write XML from a temp-table, temp-table buffers, or a ProDataSet
- Last Updated: June 7, 2019
- 5 minute read
- OpenEdge
- Version 13.0
- Documentation
Syntax
The WRITE-XML( ) method writes
an XML document containing the data of a temp-table or ProDataSet object.
The method can be used on a temp-table buffer, but here it writes
the entire contents of the associated temp-table, not just the contents
of the buffer. You can optionally write the definition of the object
along with the data. If you include the object's definition, it
is written using the XML Schema Definition (XSD) language.
When writing data from a ProDataSet object, the AVM writes the current version of data in each row of each tle in the ProDataSet object. However, you can also include any before-image data, so that both the current and original versions of the data for each table row are written.
When writing XML Schema for a ProDataSet object, the AVM writes all table definitions as well as relation and index definitions. When writing XML Schema for a temp-table or temp-table buffer object, the AVM writes table and index definitions.
Here is the syntax for WRITE-XML( ).
The method returns TRUE or FALSE to
indicate if the operation was successful.
|
- target-type
- A
CHARACTERexpression that specifies the target XML document type. 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 document text. You can specify an absolute pathname or a relative pathname (based on the current working directory). If a file with the specified name already exists, the AVM verifies that the file is writable 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 document text to the default unnamed output stream. - memptr
- A
MEMPTRvariable to contain the XML document text. The method allocates the required amount of memory for the XML document text and sets the size of the variable. When you are finished using theMEMPTR, you must free the associated memory by executingSET-SIZE(memptr) = 0on theMEMPTR. - handle
- An X-document object handle or X-noderef object handle. If the specified handle contains XML text, the AVM deletes the existing text first.
- longchar
- A
LONGCHARvariable to contain the XML document text. - formatted
- An optional
LOGICALexpression whereTRUEdirects the AVM to format the XML document text in a hierarchical manner using extra white space, carriage returns, and line feeds. The default value isFALSE. - encoding
- An optional
CHARACTERexpression that specifies the name of the character encoding the AVM uses to write the XML document text. The default encoding isUTF-8. - schema-location
- An optional
CHARACTERexpression that specifies the name of an external XML Schema file. The method uses this value to set thexsi:schemaLocationorxsi:noNamespaceSchemaLocationattribute in the XML document.Note: You must provide the location of an actual XML Schema document. Consider using theWRITE-XMLSCHEMA( )method to generate the XML Schema document. - write-xmlschema
- An optional
LOGICALexpression whereTRUEdirects the AVM to write the ProDataSet or temp-table object's definition as in-line XML Schema along with the data, andFALSEdirects the AVM to write only the data. The default value isFALSE.Note: If you specifyTRUEand theNAMESPACE-URIattribute value for a temp-table buffer within a ProDataSet object is different than that of the ProDataSet object, the method creates a separate XML Schema file for the temp-table definition. The namespace URI for the temp-table is imported into the ProDataSet schema, with aschemaLocationpointing to a separate XML Schema file containing the temp-table definition. Multiple namespaces are supported only when target-type is "FILE". If the ProDataSet object contains multiple namespaces and target-type is not "FILE", the method generates an error and returnsFALSE. - min-xmlschema
- An optional
LOGICALexpression whereTRUEdirects the AVM to write the minimum amount of schema when it writes the XML Schema representation of the object, andFALSEdirects the AVM to write the complete schema including the AVM-specific XML Schema extensions. The default value isFALSE. If you specify theUnknown value (?), the method uses the default value ofFALSE. - write-before-image
- An optional
LOGICALexpression whereTRUEdirects the AVM to write any before-image table data and error information in addition to the ProDataSet object data, andFALSEdirects the AVM to write only the ProDataSet object data. The default value isFALSE. If you specify theUnknown value (?), the method uses the default value ofFALSE. - omit-initial-values
- An optional
LOGICALexpression whereTRUEdirects the AVM to exclude temp-table fields containing their initial values from the XML document, 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.Note: For an array field to be omitted, each element of the array must contain the initial value.