<schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <element name="person"> <complexType> <sequence> <element name="name" type="xsd:string" /> <element name="children"> <complexType> <sequence> <element name="child" type="xsd:string" maxOccurs="unbounded"/> </sequence> </complexType> </element> </sequence> </complexType> </element> </schema> |
DEFINE TEMP-TABLE person NO-UNDO
FIELD name AS CHARACTER. DEFINE TEMP-TABLE children NO-UNDO FIELD person_id as RECID XML-NODE-TYPE "Hidden". DEFINE TEMP-TABLE child NO-UNDO FIELD child_Text AS CHARACTER XML-NODE-TYPE "Text" FIELD children_id AS RECID XML-NODE-TYPE "Hidden". DEFINE DATASET personDset XML-NODE-TYPE "Hidden" FOR person, children, child PARENT-ID-RELATION Relation1 FOR person, children PARENT-ID-FIELD person_id PARENT-ID-RELATION Relation2 FOR children, child PARENT-ID-FIELD children_id. |
CREATE person.
ASSIGN name = "Ken". CREATE children. ASSIGN person_id = RECID(person). CREATE child. ASSIGN child_Text = "Adam" Children_id = RECID(children). CREATE child. ASSIGN child_Text = "Elana" Children_id = RECID(children). DATASET personDset:WRITE-XML("file", "person.xml", TRUE). |
<?xml version="1.0" encoding="UTF-8"?>
<person> <name>Ken</name> <children> <child>Adam</child> <child>Elana</child> </children> <person> |