Paul,

I hope this helps (saved the XML as PaulGibson_data.xml):

dcSchemaPath = Sys(2023) + "\PaulGibson_schema.xsd"
dcXMLPath = Sys(2023) + "\PaulGibson_data.xml"
Close Databases All
Local loAdapter As Xmladapter, ;
loHelper, ;
t1 As Xmltable, t2 As Xmltable, t3 As Xmltable, t4 As Xmltable, t5 As Xmltable, t6 As Xmltable
loHelper = Createobject('XMLAdapterUtils')
loAdapter = Createobject('XMLAdapter')
*loAdapter.XMLSchemaLocation = m.dcSchemaPath && I think there is something wrong with the schema
loAdapter.LoadXML( m.dcXMLPath, .T. )
t1 = loHelper.MakeTable("parent")
t2 = loHelper.MakeTable("source")
t3 = loHelper.MakeTable("destination")
t4 = loHelper.MakeTable("action")
t5 = loHelper.MakeTable("children")
t6 = loHelper.MakeTable("child")
loHelper.MakeField(m.t1, "@ref", "refId", "I", 4,0)
loHelper.MakeField(m.t1, "id", "id", "C", 10,0)
loHelper.MakeField(m.t1, "date", "date", "C", 10,0)
loHelper.MakeField(m.t1, "time", "time", "C", 5,0)
loHelper.MakeField(m.t2, "addr1","saddr1", "C",20,0)
loHelper.MakeField(m.t2, "addr2","saddr2", "C",20,0)
loHelper.MakeField(m.t2, "addr3","saddr3", "C",20,0)
loHelper.MakeField(m.t2, "addr4","saddr4", "C",20,0)
loHelper.MakeField(m.t2, "addr5","saddr5", "C",20,0)
loHelper.MakeField(m.t2, "postcode","spostcode", "C",10,0)
loHelper.MakeField(m.t3, "addr1","daddr1", "C",20,0)
loHelper.MakeField(m.t3, "addr2","daddr2", "C",20,0)
loHelper.MakeField(m.t3, "addr3","daddr3", "C",20,0)
loHelper.MakeField(m.t3, "addr4","daddr4", "C",20,0)
loHelper.MakeField(m.t3, "addr5","daddr5", "C",20,0)
loHelper.MakeField(m.t3, "postcode","dpostcode", "C",10,0)
loHelper.MakeField(m.t4, "when","when", "C",20,0)
loHelper.MakeField(m.t4, "where","where", "C",20,0)
loHelper.MakeField(m.t4, "actor","actor", "C",20,0)
loHelper.MakeField(m.t6, "@id","childId", "C",10,0)
loHelper.MakeField(m.t6, "length","", "I",4,0)
loHelper.MakeField(m.t6, "breadth","", "I",4,0)
loHelper.MakeField(m.t6, "width","", "I",4,0)
loHelper.MakeField(m.t6, "weight","", "I",4,0)
loAdapter.Tables.Add(m.t1, m.t1.XMLName)
loAdapter.Tables(1).ToCursor(.f.,'crsParent')
t1.ChildTable = m.t2
loAdapter.Tables(1).ToCursor(.f.,'crsSource')
t1.ChildTable = m.t3
loAdapter.Tables(1).ToCursor(.f.,'crsDestination')
t1.ChildTable = m.t4
loAdapter.Tables(1).ToCursor(.f.,'crsAction')
t1.ChildTable = m.t5
t5.ChildTable = m.t6
loAdapter.Tables(1).ToCursor(.f.,'crsChildren')
Define Class XMLAdapterUtils As Custom
Procedure MakeTable(tcTableName)
Local loTable As Xmltable
loTable=Createobject("XMLTable")
loTable.XMLName = Strconv(m.tcTableName,5)
loTable.Alias=m.tcTableName
Return loTable
EndProc
Procedure MakeField(toTable,tcXMLName, tcFieldName,tcFieldType,tnFieldLen,tnDecimals)
Local loField As Xmlfield
loField=Createobject("XMLField")
loField.XMLName=Strconv(m.tcXMLName,5)
loField.Alias=Evl(m.tcFieldName,m.tcXMLName)
loField.XMLNameIsXpath = .T.
loField.DataType=m.tcFieldType
loField.MaxLength=m.tnFieldLen
If Evl(m.tnDecimals,0) > 0
loField.FractionDigits = m.tnDecimals
Endif
toTable.Fields.Add(loField,loField.XMLName)
Endproc
Enddefine

Cetin Basoz

**.Net has got better.**Think about moving - check my blog:

My Blog

MongoDb Certified Developer

MongoDb Certified DBA