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 ProDataSet
 
Inferring schema for a ProDataSet
Suppose you have an XML document for a dataset, but you have no XML Schema for it. You can call the READ-XML( ) method on a ProDataSet handle and create a dynamic ProDataSet object in ABL.
This XML document is an example:
<?xml version="1.0"?>
<myDataSet>
<Department>
<DeptCode>400</DeptCode>
<DeptName>Sales</DeptName>
</Department>
<Employee EmpNum="3">
<DeptCode>400</DeptCode>
<LastName>Smith</LastName>
<FirstName>Lee</FirstName>
<Address>1342 Atlantic Ave</Address>
<City>Boston</City>
</Employee>
<Family RelativeName="Ken Koberlein">
<Relation>Spouse</Relation>
<IncludedOnBenefits>true</IncludedOnBenefits>
<EmpNum>3</EmpNum>
</Family>
</myDataSet>
Using READ-XML( ) on a ProDataSet object will create a ProDataSet named myDataSet with three temp-table buffers: Department, Employee and Family. The Department temp-table has two CHARACTER fields: DeptCode and DeptName. The Employee temp-table has six CHARACTER fields: EmpNum, DeptCode, LastName, FirstName, Address and City. The Family temp-table has four CHARACTER fields: RelativeName, Relation, IncludedOnBenefits, and EmpNum.
Using READ-XML( ) on a temp-table object will fail, since there is more than one temp-table represented in the XML document.