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
Solved

Xml table

Posted on 2003-12-10
3
792 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

792 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