Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML Data from Temp-Tables and ProDataSets : Using XML Schema : Inferring definitions from XML data : Inferring schema for a temp-table
 
Inferring schema for a temp-table
Suppose you have an XML document for a single temp-table, but you have no XML Schema for it. You can either call the READ-XML( ) method on a temp-table handle and create a dynamic temp-table object in ABL; or, you can call the READ-XML( ) method on a ProDataSet handle and create a dynamic ProDataSet object with a single temp-table buffer in ABL.
For example, examine this XML document:
<?xml version="1.0"?>
<Rows>
<ttFam RelativeName="Ken Koberlein">
<Relation>Spouse</Relation>
<IncludedOnBenefits>true</IncludedOnBenefits>
<EmpNum>1</EmpNum>
</ttFam>
<ttFam RelativeName="Kelly Smith">
<Relation>Daughter</Relation>
<IncludedOnBenefits>true</IncludedOnBenefits>
<EmpNum>3</EmpNum>
</ttFam>
<ttFam RelativeName="Mark Smith">
<Relation>Spouse</Relation>
<IncludedOnBenefits>true</IncludedOnBenefits>
<EmpNum>3</EmpNum>
</ttFam>
<ttFam RelativeName="Sam Smith">
<Relation>Son</Relation>
<IncludedOnBenefits>false</IncludedOnBenefits>
<EmpNum>3</EmpNum>
</ttFam>
</Rows>
Using READ-XML( ) on a temp-table object with this XML document will create a temp-table named ttFam, with four CHARACTER fields: RelativeName, Relation, IncludedOnBenefits and EmpNum.
Using READ-XML( ) on a ProDataSet object with this XML will create a ProDataSet named Rows, with one temp-table buffer, ttFam, with all its buffer-fields.