PreviousNextIndex

WRITE-XMLSCHEMA( ) method

Writes an XML representation of the definition of a ProDataSet, temp-table, or temp-table buffer object (that is, an XML Schema file). The XML Schema is written using the XML Schema Definition (XSD) language.

When writing schema for a ProDataSet object, the AVM writes all table definitions as well as relation and index definitions. When writing schema for a temp-table or temp-table buffer object, the AVM writes only table and index definitions.

Return type: LOGICAL

Applies to: Buffer object handle, ProDataSet object handle, Temp-table object handle

Syntax
WRITE-XMLSCHEMA ( mode, 
   { file | stream | stream-handle | memptr | handle | longchar }
   [, formatted [, encoding [, min-xmlschema 
   [, omit-initial-values ] ] ] ] ) 

mode
file
stream
stream-handle
memptr
handle
longchar
formatted
encoding
min-xmlschema
omit-initial-values

If the NAMESPACE-URI attribute value for a temp-table 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 a schemaLocation pointing to a separate XML Schema file containing the temp-table definition. Multiple namespaces are supported only when mode is “FILE”. If you specify multiple namespaces and mode is not “FILE”, the method generates an error and returns FALSE.

You can specify how a temp-table column is represented in XML Schema (that is, as an ELEMENT, ATTRIBUTE, or TEXT) by:

When writing schema for a ProDataSet object that contains data-relations, you can nest child rows of a ProDataSet buffer definition within their parent buffer definitions in the resulting XML Schema by:

If your temp-tables contain array fields, third party products utilizing the XML Schema might not map the ABL array field to an array column or object. For best interoperability with third party products, flatten array fields into individual fields.

You cannot write an XML representation of the schema for a database buffer.

The following code example defines a static ProDataSet object and writes the ProDataSet object schema to an XML Schema file:

DEFINE VARIABLE cTargetType AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cFile       AS CHARACTER NO-UNDO. 
DEFINE VARIABLE lFormatted  AS LOGICAL   NO-UNDO. 
DEFINE VARIABLE cEncoding   AS CHARACTER NO-UNDO. 
DEFINE VARIABLE lMinSchema  AS LOGICAL   NO-UNDO. 
DEFINE VARIABLE lRetOK      AS LOGICAL   NO-UNDO. 
DEFINE TEMP-TABLE ttCustomer NO-UNDO LIKE Customer. 
DEFINE TEMP-TABLE ttOrder    NO-UNDO LIKE Order. 
DEFINE TEMP-TABLE ttInvoice  NO-UNDO LIKE Invoice. 
DEFINE DATASET DSET FOR ttCustomer, ttOrder, ttInvoice 
  DATA-RELATION CustOrd FOR ttCustomer, 
    ttOrd RELATION-FIELDS(CustNum, CustNum) NESTED 
  DATA-RELATION OrdInv FOR ttOrder, 
    ttInv RELATION-FIELDS(OrderNum, OrderNum) NESTED. 
ASSIGN 
  cTargetType = "file" 
  cFile       = "cust-ord-inv.xsd"  
  lFormatted  = TRUE 
  cEncoding   = ? 
  lMinSchema  = FALSE. 
lRetOK = DATASET DSET:WRITE-XMLSCHEMA(cTargetType, cFile, lFormatted, 
  cEncoding, lMinSchema). 

The following code example defines a static temp-table object, and writes the temp-table object schema to an XML Schema file:

DEFINE VARIABLE cTargetType AS CHARACTER NO-UNDO. 
DEFINE VARIABLE cFile       AS CHARACTER NO-UNDO. 
DEFINE VARIABLE lFormatted  AS LOGICAL   NO-UNDO. 
DEFINE VARIABLE cEncoding   AS CHARACTER NO-UNDO. 
DEFINE VARIABLE lMinSchema  AS LOGICAL   NO-UNDO. 
DEFINE VARIABLE lRetOK      AS LOGICAL   NO-UNDO. 
DEFINE TEMP-TABLE ttCust NO-UNDO LIKE Customer. 
ASSIGN 
  cTargetType = "file" 
  cFile       = "ttCust.xsd"  
  lFormatted  = TRUE 
  cEncoding   = ? 
  lMinSchema  = FALSE. 
lRetOK = TEMP-TABLE ttCust:WRITE-XMLSCHEMA(cTargetType, cFile, lFormatted, 
  cEncoding, lMinSchema). 

See also: ENCODING attribute, FIX-CODEPAGE statement, FOREIGN-KEY-HIDDEN attribute, NAMESPACE-PREFIX attribute, NAMESPACE-URI attribute, NESTED attribute, READ-XML( ) method, READ-XMLSCHEMA( ) method, WRITE-XML( ) method, XML-NODE-TYPE attribute


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex