Problem solve Get help with specific problems with your technologies, process and projects.

Using XML in Delphi

Hi. I am a Delphi programmer. I want to receive XML in Delphi. In fact, I want to know how I make a Web server be able to receive XML packets and use its information to insert its information in a database with Delphi.

I have been asked to write an application in Delphi for a company. They said they will send me all information I need in XML format to use in the database. I don't have any clear vision of what exactly XML is and how I should do that. I have read about some components in Delphi that work in XML. But could you guide me as to how I should do that and answer:

  1. What XML exactly is? Is it transform in file format or packets?
  2. How should I receive them in my application? Do they send in a known path or through a socket or whatever?
  3. How do I know that XML is sent to my application? Should I check it out once a while or is there any component to use which understand it in an event?
  4. How can I make a Web server able to receive XML?
  5. How can I send XML?
  6. Which components are useful for me?

I am using Delphi 7. Thanks a lot.
I?d say you got to the wrong place. This is the Visual Studio .NET center, no Delphi around here ;) However, being myself an ex-Delphi programmer, here goes some ideas that may help:

  1. XML is a format, much like a comma-separated file is, or an INI, or whatever.

  2. Transport is different that the file contents and format. You can get the XML data as a stream across a socket, as a file in a mail attachment, as an uploaded file through POST and even compressed with a zip-like algorithm. That?s completely application-dependent. What is important is that no matter how you got to it, once you have the XML in-memory (through what is called a parser), you can work with it in a standard manner irrespectively of its content. There?s a known API for iterating it (the DOM-document object model), querying it (XPath) and transforming it to something else (XSLT).

  3. The XML can be designed to be conformant to a predefined schema (called XML Schema, which is also standard). You can have your application validate the incoming XML data against the schema, and thus be sure that what you?re about to process (in whatever way your particular needs dictate) is valid according to it.

  4. So far, all the features I mentioned about XML (Parser, XPath, XSLT and XML Schema) surely have a corresponding component/class in Delphi implementing them. The best way to make your server accept XML is completely dependent on your requirements. If it?s a Web server, maybe the easiest way would be to just accept it through a regular POST action. As of Delphi 6, you had a cool (I?ve been told so) feature called WebSnap that made it very easy to expose application logic as services on a Web server (a.k.a. Web service). I bet Delphi 7 is even better at that.

  5. Again, you can send it in whichever way it?s available between your server and your client.

  6. Talk with a Delphi programmer! (not an ex-one ;))

Dig Deeper on .NET Framework development with XML and XAML

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.