Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Xml table

Posted on 2003-12-10
Medium Priority
Last Modified: 2013-11-19

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?
Question by:lfgmartins
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 17

Accepted Solution

Wim ten Brink earned 2000 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.

Featured Post

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

730 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