Perhaps this has been asked before, but I haven't found it with regards to Delphi - I have used a XSD.exe in Visual Studio that does exactly this: converts XSD into 'plain vanilla' classes representing the entities specified in the XSD - not bound to XML document - classes for creating the structures in the XSD, not accessing data that conforms to the structure outlined in the XSD.
I am looking for a utility or product that will do this (that doesn't cost big bucks...) : Example, I have a schema like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="TDelphiClass">
<xs:complexType>
<xs:sequence>
<xs:element ref="ID"/>
<xs:element ref="ConnectionString"/>
<xs:element ref="Group"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="ID" type="xs:integer"/>
<xs:element name="ConnectionString" type="xs:string"/>
<xs:element name="Group"type="xs:double"/>
</xs:schema>
I want to generate a Delphi unit/class that looks like this:
unit uDelphiClass;
interface
uses
Classes, SysUtils;
type
TDelphiClass = class(TObject)
fID: Integer;
fConnectionString: string;
fGroup: Double;
end;
implementation
end.
Reading between the lines (please use less abbreviations, for instance, VS has multiple meanings, even in computing), and You probably used the XSD.EXE tool in Visual Studio or the .NET SDK to generate your source code in the C# or VB.NET language.
If you have Delphi Prism, you can use XSD.EXE to generate Delphi Prism source code.
The Delphi Prism language is very close to the Delphi native language, so that will give you a kick start.
This should work with the Delphi Prism trial too.
BTW: Why do you not want to use the Delphi native code generated by the XML Data Binding Wizard in a standalone way? It is interface based, but is pretty fast and works very well.
http://sourceforge.net/projects/xxsd2code/ generates C++, C#, C++/CLI and Java - and it looks like the included 'LanguageWriter' classes are not too complicated to extend them for Delphi. The Java LanguageWriter for example has less than 400 lines. If there is interest in the Delphi community this could be implemented and contributed in a short timeframe...
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