Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Examples, how to, etc for XML, XSD in VFP 9
Message
De
13/04/2007 09:51:57
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01215484
Message ID:
01215506
Vues:
26
>I finally have a real reason to learn XML. We are looking at interfacing with a payroll program that can take all the payroll detail from our program, do the full payroll stuff and then export it so we can get all the accounting data, etc. Full payroll has been the only thing lacking in our management system.
>
>The program uses XML for the import/export. I understand XML and XSD in theory only. I can read the stuff but I don't know the best way to read/write it or handle it in general using VFP 9.
>
>I can do about anything with VFP and I have done some really creative stuff with TEXT ... ENDTEXT and textmerge(). I have done many ASCII import/export programs.
>
>Can anyone point me to some advanced examples or doc on what I need?
>Thanks.

John,
You're lucky:) New XMLAdapter is fantastic for the job (recently I'm using it to create hierarchical, user editable HTML reporting - XML,HTML,XHTML,XSL transformations). One sample or two is not enough to see its power and the sample might not be geared towards what you need (ie: if you need it to exchange data with .Net datasets there is completely different one), anyway here is a very simple one:
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 order_id INTO 'orditems' IN 'orders'
SET RELATION TO emp_id INTO 'employee' IN 'orders' additive

LOCAL oAdapter as XMLAdapter
oAdapter = CREATEOBJECT('xmlAdapter')
oAdapter.RespectNesting = .t.
oAdapter.AddTableSchema('customer',.f.,STRCONV('Customer',12))
oAdapter.AddTableSchema('orders',.f.,STRCONV('OrdersOfCustomer',12))
oAdapter.AddTableSchema('orditems',.f.,STRCONV('OrderDetails',12))
oAdapter.AddTableSchema('employee',.f.,STRCONV('SalesPerson',12))
*oAdapter.XMLSchemaLocation = 'c:\temp\myExternalSchema.xsd'
oAdapter.ToXML('myTest.XML','',.T.)

MODIFY COMMAND myTest.xml
XSD is the schema of the tables. You can have it external (creates external if not exists). Default is to include schema.
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform