Read XML into a temp-table, temp-table buffer, or ProDataSet
- Last Updated: June 7, 2019
- 4 minute read
- OpenEdge
- Version 13.0
- Documentation
Syntax
The READ-XML( )method
is used for loading data into static or dynamic temp-table, temp-table
buffer, and ProDataSet objects from an XML document. Optionally,
you can specify an XML Schema to create an ABL definition for a
dynamic object or to verify the XML Schema against a static or dynamic
object definition.
Here is the syntax for READ-XML( ).
The method returns TRUE or FALSE to
indicate if the operation was successful.
|
- source-type
- A
CHARACTERexpression that specifies the source XML document type. Valid values are: "FILE", "MEMPTR", "HANDLE", and "LONGCHAR". - file
- A
CHARACTERexpression that specifies the name of a file. You can specify an absolute pathname, a relative pathname (based on the current working directory), or a URL pathname. Valid URL protocols includeFILEandHTTP(theHTTPSprotocol is not supported). The AVM verifies that the file exists and is accessible. - memptr
- A
MEMPTRvariable that contains the XML document text. The size of theMEMPTRvariable must match the size of the XML document text. - handle
- A
WEB-CONTEXTsystem handle, X-document object handle, or X-noderef object handle. - longchar
- A
LONGCHARvariable that contains the XML document text. - read-mode
- A
CHARACTERexpression that specifies the mode in which theREAD-XML( )method reads data from the XML document into a temp-table or ProDataSet member buffer. The expression must evaluate to "APPEND", "EMPTY", "MERGE", or "REPLACE". The default value is"MERGE". - schema-location
- A
CHARACTERexpression that specifies the name of an external XML Schema file to use in creating or verifying the object's definition when reading in the XML document. You can specify an absolute pathname, a relative pathname (based on the current working directory), or a URL pathname. Valid URL protocols includeFILEandHTTP(theHTTPSprotocol is not supported). The AVM verifies that the file exists and is accessible. When specified, the AVM ignores any XML Schema defined or referenced in the source XML document. - override-default-mapping
- A
LOGICALexpression whereTRUEdirects the AVM to override the default mapping between XML Schema string and binary data types and ABL data types when creating a temp-table definition from an XML Schema. The default value isFALSE. - field-type-mapping
- An optional
CHARACTERexpression that evaluates to a comma-separated list of field name, data type pairs using the following syntax:field-name-1, data-type-1[, field-name-n, data-type-n]...)This option allows you to specify the ABL data type for a specific field from the XML Schema. Generally, this option is only used to map fields from non-ABL generated schema. When reading and writing ABL-generated XML Schema, there is little need to override field mappings because of the ABL extensions to standard XML Schema.
- field-name
- The name of the specified field. For a ProDataSet object, you must qualify the field name with the buffer name from the XML Schema: that is, buffer-name.field-name.
- data-type
- The target ABL data type of the specified field. The data type
must be a valid ABL data type, and it must be compatible with the
XML Schema type based on the ABL XML data type mapping rules. For
example, any XML Schema type can be mapped to ABL
CHARACTERorCLOB, but an XML SchemadateTimecan be mapped only to an ABLDATE,DATETIMEorDATETIME-TZ.
Note: If the temp-table or ProDataSet has an ABL definition, this option is ignored. - verify-schema-mode
- An optional
CHARACTERexpression that specifies the mode in which theREAD-XML( )method verifies any XML Schema against existing ABL definitions. The expression must evaluate to "IGNORE", "LOOSE", or "STRICT". The default value is "LOOSE".Note: For a dynamic temp-table or ProDataSet member buffer that does not have an ABL definition (that is, the object is in theCLEARstate), this option is ignored.