Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some questions about XMLAdapter
Message
From
26/10/2007 07:58:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/10/2007 07:29:19
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01263958
Message ID:
01264013
Views:
20
>>>I have some questions about xmladapter
>>>
>>>1). I need add 2 tables into xml, is it possible to make like parent-child relation using xml adapter as
>>>
>>><order>
>>> <ordernumber>1</ordernumber>
>>> <positions>
>>>   <position>
>>>      <number>1</number>
>>>      <key>MSW1232-CP</key>
>>>      <description>Prduct Description</description>
>>>   </position>
>>> </positions>
>>></order>
>>>
>>>
>>>2) Is it possible using XMLAdapter export XSD schema only or I must cut schema from xml document?
>>>
>>>3) Is it possible to export xml XMLAdapter.ToXML() without XSD schema?
>>
>>1) Yes
>>2) Yes
>>3) Yes
>>
>>
>>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
>
>
>
>Hi Cetin,
>Thenks for help, as I understand the RespectNesting - is VFP9 feature and for VFP8 - this not available

Oh sorry I didn't pay attention to version.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform