>>><order> >>> <ordernumber>1</ordernumber> >>> <positions> >>> <position> >>> <number>1</number> >>> <key>MSW1232-CP</key> >>> <description>Prduct Description</description> >>> </position> >>> </positions> >>></order> >>>>>>
>>CLEAR all >>USE (_samples+'data\customer') IN 0 >>USE (_samples+'data\orders') IN 0 ORDER tag cust_id >>USE (_samples+'data\orditems') IN 0 ORDER tag order_id >>USE (_samples+'data\employee') IN 0 ORDER tag emp_id >> >>SET RELATION TO cust_id INTO orders IN 'customer' >>SET RELATION TO emp_id INTO employee IN 'orders' >>SET RELATION TO order_id INTO orditems IN 'orders' additive >> >>LOCAL oAdapter as XMLAdapter >>oAdapter = CREATEOBJECT('xmlAdapter') >>oAdapter.RespectNesting = .t. >>oAdapter.XMLName=STRCONV("MySampleRootName",12) && default "VFPDataSet" >>oAdapter.AddTableSchema('customer',.f.,STRCONV('Customer',12)) >>oAdapter.AddTableSchema('orders',.f.,STRCONV('OrderHeader',12)) >>oAdapter.AddTableSchema('orditems',.f.,STRCONV('OrderDetail',12)) >>oAdapter.AddTableSchema('employee',.f.,STRCONV('SalesMan',12)) >> >>lcXMLFileName = sys(2015)+'.xml' >>lcXSDFileName = forceext(m.lcXMLFileName,'xsd') >> >>oAdapter.XMLSchemaLocation = m.lcXSDFileName && comment for inline schema >>oAdapter.ToXML(m.lcXMLFileName,'',.T.) && to file >>*oAdapter.ToXML('cXMLSampleData','',.f.) && to memvar >> >>* Check what is generated >>modi comm (m.lcXMLFileName) >>modi comm (m.lcXSDFileName) >>erase (juststem(m.lcXMLFileName)+'.*') >>>>Cetin