Writing apps that use XML storage solutions
I am an old Xbase programmer trying to update myself, but experiencing only minor success at this point. The problem: Converting (as a teaching exercise) a small data storage and reporting application from Visual FoxPro to C# and utilizing XML tables as the storage device. When developing the app in VFP I simply create the empty tables and then write appropriate code to append, insert or delete data. In reading some of the articles on this site and experimenting with XML tables, it appears that the table cannot exist as an empty container, but must be initialized with dummy data. That just seems wrong to me. Of course, the problem really only exist with a new install. Once the table(s) have data in them I find it easy to treat them just as I would a VFP or dBase table. Perhaps it is a matter of improper understanding or perspective. Can someone straighten me out?
VulpesPosted Apr 16, 2013, 10:22 AM
http://www.w3schools.com/schema/
Virgil BevansPosted Apr 15, 2013, 6:55 PM
USE Contacts
Append Blank
Replace FirstName With "John";
LastName With "Doe";
StreetAdd With "123 East St."
etc.
I'm led to believe that this same type of procedure (of course coded in C# and perhaps using LINQ technology) would work with an XML table as long as it had at least one entry already in it, thereby supplying a structure to the table, but a new install would have no data. Likewise, maybe the app would have a function to "reset", clearing all old records and starting over. Again no data and apparently no structure.
Is an "xsd" file the proper way to supply a structure for the table and if so, how is it used?
Again, maybe I just have a total misunderstanding of the concept.
VulpesPosted Apr 15, 2013, 12:58 PM
After this program has been run, the XML file created looks like this: