I know that you cannot fully describe the XML that the TClientDataSet with an XSD schema, as the ROW elements have attributes that have names that vary with the contents.
However, the METADATA section of such an XML should be.
So: is there anyone having a (partial) XSD that describes the METADATA portion of the XML that can be saved with Delphi TClientDataSets?
Regards.
PS:
Thanks for the pointers to XML->XSD conversion tools/sites; I should have written that I did that myself as well, but that generating that XSD in a proper way (i.e. one that covers all possibilities) will need input XML that cover all possibilities (like roundtrip, rowstate, etc). I'll try to come up with a decent XSD that way and post it here.
Edit:
Split the XSD in two parts, and made it more complete by using these files in
Delphi XE
:dsconst.h
,dspickle.h
,dsxml.h
.Please PM or comment if you have additions.
The XSD files below seems to work reasonably so far; if you have TClientDataSet XML that does not validate with this, please email me your XML (Google me or put a comment below for my mail address).
First the file
CDS.xsd
, which includes the fileCDS_METADATA_FIELDS_include.xsd
further on.It defines the basic structure of a TClientDataSet XML document:
DATAPACKET
, containingMETADATA
andROWDATA
, whereMETADATA
containsFIELDS
andPARAMS
, andROWDATA
containsROW
elements:Note that
ROW
elements are very loosely typed, as they will contain attribute names that are dynamically defined.Then the file
CDS_METADATA_FIELDS_include.xsd
which contains the underlying meta data used by theFIELDS
andPARAMS
elements.It is not yet fully complete, as I haven't found CDS XML files containing the keywords mentioned in the comments below.
Regards.
Well I couldn't find one either, so I used this website to generate this schema based on a ClientDataSet XML file.
I am a total newbie in Delphi, but had to deal with parsing a TClientDataSet in XML format. I also needed a list of all the possible values for the field type. Did some digging into the Delphi source and came up with this list.
If you want to include the field types in the schema then you should include all the types listed here:
Thanks for a doing a nice job of defining this schema. This helps a lot.