Infer data-relations from nested XML and XML Schema
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
ABL supports the mapping of complex XML and XML Schema to a ProDataSet definition. When temp-tables within the XML are nested, a relationship is required between the parent table and its nested child in order to preserve the round-trip of the schema and data serialization.
When there is no explicit relationship defined in the XML Schema,
or no implicit relationship can be found based a matching field
in the parent and nested child tables, ABL provides a PARENT-ID-RELATION for
the ProDataSet. A PARENT-ID-RELATION relates the
parent and child based on the RECID of the parent record.
The PARENT-ID-RELATION allows ABL to expand the
set of XML formats that can map to a ProDataSet. This expanded
support includes the following:
-
READ-XML( ),READ-XMLSCHEMA( ), and thebproxsdto4glutility will create aPARENT-ID-RELATIONwhen reading XML or XML Schema if aDATA-RELATIONcannot be used to represent the nested XML. These methods will also add a RECID field to the child table withXML-NODE-TYPE "HIDDEN"to hold the RECID of the parent record. When creating records,READ-XML( )will automatically populate the added field in the child table with the RECID of the parent record. -
WRITE-XML( )andWRITE-XMLSCHEMA( )recognize thePARENT-ID-RELATIONand serialize the data and schema correctly. - The
PARENT-ID-RELATIONphrase is available on theDEFINE DATASETstatement, and theADD-PARENT-ID-RELATIONmethod is available on a dynamic ProDataSet object. -
PARENT-FIELDS-BEFOREandPARENT-FIELDS-AFTERoptions are available on aPARENT-ID-RELATION, which specify which parent fields are to be serialized before and after the nested child records. -
XML-NODE-TYPEandSERIALIZE-HIDDENare available at the ProDataSet level so that a ProDataSet can be serialized with the top-level temp-table as the root node of the XML document.