Using Delphi XE:
XML data binding wizard generates Delphi class based on XML/XSD - works great.
BUT I also need to go the other way: Convert Delphi classes into XML. I don't find any support for that in XE. (I know this is quite simple to accomplish with C#, .NET, but obviously, since Delphi doesn't really support Reflection it's a lot more difficult than with C#)
One option I do have it is write the class in C# with SharpDevelop and use the MS utility (which I believe is a free download) to generate XML from the C# code. I also have VS 2005 that supports this, but it's not installed and I'd prefer not get to involved with it).
Anyone have a suggestion as to how to go about getting this done: Straight from Delphi to XML/XSD? An open source tool would be nice, or some good units that will do this.
The NativeXml and OmniXML open source libraries can convert Delphi objects to XML (not XSD). They support object serialization and deserialization even with Delphi versions before 2010.
So it would be possible to use them in a first step to create a XML file, which then can be passed to the Data Binding Wizard for Delphi class code generation.
Robert Love wrote an article in late 2009 covering that topic: Xml Serialization - Basic Usage. It uses the "new" RTTI available as of Delphi 2010.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With