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:
- What XML exactly is? Is it transform in file format or packets?
- How should I receive them in my application? Do they send in a known path or through a socket or whatever?
- 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?
- How can I make a Web server able to receive XML?
- How can I send XML?
- 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:
- XML is a format, much like a comma-separated file is, or an INI, or whatever.
- 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).
- 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.
- 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.
- Again, you can send it in whichever way it?s available between your server and your client.
- Talk with a Delphi programmer! (not an ex-one ;))
Dig Deeper on .NET Framework development with XML and XAML
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.