Hello there folks,
For the past few days I have been trying to wrap my head around this
project - which involves exporting and importing of EDI files via the
XML format from within VFP. I even looked at a previous discussion
thread for help:
http://leafe.com/archives/showMsg/354418
And this thread also referred me to another webpage that was helpful:
http://foxcentral.net/microsoft/WhatsNewInVFP9_Chapter10.htm
I also looked at the VFP Help to get a better understanding of XML,
schemas, the XMLAdapter, XMLTOCURSOR, and CURSORTOXML.
Although, at this point - I am not really clear as to the difference
between using the XMLAdapter vs XMLTOCURSOR and CURSORTOXML. I do need
to have Nesting within the XML files, and I know the Adapter thing
supports that. But, not sure about whether XMLTOCURSOR and CURSORTOXML
can handle that.
Based upon the Chapter 10 link above, and the sample Northwind files
that come with VFP - I used the following program to output an XML file:
LOCAL loXMLAdapter
CLOSE DATABASES ALL
OPEN DATABASE (HOME() + [samples\northwind\northwind])
USE Categories IN 0
USE Products IN 0 ORDER CategoryID
SELECT Categories
SET RELATION TO CategoryId INTO Products ADDITIVE
loXMLAdapter = CREATEOBJECT([XMLAdapter])
WITH loXMLAdapter AS XMLAdapter
.XMLSchemaLocation = [AddTableToSchema_Nest2.xsd]
.RespectNesting = .T.
.AddTableSchema([Categories])
.AddTableSchema([Products])
.ToXML([AddTableToSchema_Nest2.xml], [], .T.)
MODIFY FILE AddTableToSchema_Nest2.xml
ENDWITH
loXMLAdapter = .NULL.
And, of course, I was able to successfully output an XML file and the
appropriate Schema file. At that point I wanted to try and read that XML
data back IN to a table. So, I wiped out the data in a copy of the
Categories and Products dbf files. Then, I referenced those files in the
following code in an attempt to read in the data from the XML file:
LOCAL loXMLAdapter
CLOSE DATABASES ALL
USE Categories IN 0
USE Products IN 0 ORDER CategoryID
SELECT Categories
SET RELATION TO CategoryId INTO Products ADDITIVE
loXMLAdapter = CREATEOBJECT([XMLAdapter])
WITH loXMLAdapter AS XMLAdapter
.XMLSchemaLocation = [AddTableToSchema_Nest2.xsd]
.RespectNesting = .T.
.AddTableSchema([Categories])
.AddTableSchema([Products])
.LoadXML([AddTableToSchema_Nest2.xml], .T., .T.)
ENDWITH
loXMLAdapter = .NULL.
At this point - the program ran without a problem. But, the DBF files
remained empty. I know I am doing something wrong - and that the data
may get store inside of the XMLAdapter object - but, I am not sure how
that relates to the tables - and therefore how to get the data back into
the tables from the XML file!
Thanks in advance for any help!!!
Kurt
--- StripMime Report -- processed MIME parts ---
multipart/alternative
text/plain (text body -- kept)
text/html
---
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/289ea162f5642645b5cf64d624c66a14048e6...@us-ny-mail-002.waitex.net
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.