Solved

Xml table

Posted on 2003-12-10
3
774 Views
Last Modified: 2013-11-19
Hi,

I've got a XML table. It has the structure I want for my project, but I can't see it. I want to view the fields, size, type, indexes,... Is it possible in Delphi? If I put this table in Delphi, it knows the fields names. If it finds it's names then they're identified. How?
Is there any way to convert it to Paradox?
Thanks,
Luis
0
Comment
Question by:lfgmartins
3 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 500 total points
ID: 9919234
Let me guess. You've used the XML Data Binding wizard to generate some Delphi source to access your XML data? Okay, first a warning then. The XML Data Binding wizard has a few flaws. It doesn't handle datetime types correctly (dates or times are okay), it writes booleans in the wrong way (xml is case-sensitive so true and True are not the same) and Delphi doesn't write sequences in the correct order. So I'm not too happy about this wizard...

A better option is the XML Mapping Tool. You open the XML file using this tool, select the field that you need as a record-structure, then generate a data package. This will create a transformation file that you can use to transform the XML data to an XML datapacket. This Datapacket can then be used with the ClientDataset to be used as a dataset in your application.
Unfortunately Delphi isn't perfect here either. The transformation file that Delphi generates generates &lt; and &gt; tags in the transformation output instead of < and > when you use the transformation outside Delphi. Quite annoying...

However, the TXMLDocument is reasonable reliable. and if you know about Delphi's weaknesses with XML you can easily get around them.
-------------------------------------------------------------------
Now, about viewing the XML data... Unfortunately Delphi doesn't have any XML-related visual components. You either have to write your own code to display the data (virtual listviews and treeviews are very usable) or find some 3rd-party components. With Octane (D8) then it will be easier since then you'll be using .NET to work with xml, which is a bit more reliable.
-------------------------------------------------------------------
Converting an xml table to Paradox is possible but it depends a bit on the structure of your xml file. A simple structured XML file can easily be converted by walking through it and inserting records as you go. If the xml structure has multiple layers then you have to generate master-detail relations to generate multiple tables. I have been using xml files that would convert to a dozen or so different paradox tables if I would ever convert them, so I prefer to keep them as xml.
-------------------------------------------------------------------
if you have a table that is converted to xml then you can open it with the TClientDataset or the TADODataset. It depends on which tool generated the XML table. Be aware that an XML doesn't contain information about it's own structure but could contain a link to an xml schema. This schema describes all elements and attributes and all rules that apply to it.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now