Wiki copymirror

This is a mirror of the wiki at pascal.chat. Editing, history and sign-in are there.

fpXMLXSDExport

English · Français

Overview

FPC

The fpXMLXSDExport module is part of fpDBExport in the FreePascal FCL database modules.

This export module provides export to various forms of XML, selectable by the ExportFormat setting. Note that not exporting indexes appears as a limitation in most formats below, but indexes probably will probably need to be changed anyway in an new environment/database.

There is also a fpsimplexmlexport module which can export a single format XML.

Lazarus

The component is located on the Data Export tab.

Export formats

This component supports various XML formats.

AccessCompatible

This format generates Microsoft Access XP/2002-2010 (and presumably SQL Server) compatible XML.

You can specify to include or exclude inline XSD data definition with the CreateXSD setting. Recommended to leave it to true so Access can build up the table structure. If you have an existing compatible table, you wouldn't need the XSD.

Index definitions are exported in this format.

The Access format as emitted by Access XP at least uses the decimal separator of the computer the export is running on. E.g. a US locale will emit 42.42, while a Dutch locale will emit 42,42. If you want to override the decimal separator to a value regardless of locale (recommended if exchanging data across multiple locales), please set the DecimalSeparator (e.g. to '.').

Limitations:

ADONETCompatible

This format generates XML compatible with the .Net framework (specifically the ADO.NET data access libraries). It should work for versions 2 to 4; version 1/1.1 has not been tested.

In this format you can also specify XSD or no XSD using the CreateXSD setting. This output format is fairly generic and could be usable for import in other applications, as well.

Limitations:

ExcelCompatible

This format generates Microsoft Excel XP/2002-2010 compatible XML.

This format recreates the data as Excel worksheet data. It does not include formatting and formulas, just plain data.

The CreateXSD setting has no effect in this format - the Excel XML format doesn't seem to support compatible metadata.

Limitations:

The FPSpreadsheet code could be a good alternative to this format: it offers native format output and probably multiline support.

DelphiClientDataset

This format generates Delphi ClientDataset compatible XML.

This format allows Delphi applications to use the ClientDataset.LoadFromFile method to read the data.

It has been written based on TurboDelphi (Delphi 2006) behaviour and exports UTF-8 encoded XML.

The CreateXSD setting has no effect in this format - Clientdataset metadata is always exported.

Limitations:

Other settings

As the XML formats used above defines how date/time formats, Boolean formats etc are used, these general export settings have no effect:

Lazarus and examples

For an example, please see the xmlxsdexporttest.lpr test program in packages\fcl-db\tests.

An additional example can be found in your FPC installatoin in packages\fcl-db\examples\dbftool.lpr.

In Lazarus, you can use the lazdbexport package (the TFPDataExporter and TStandardExportFormats components in particular) to use this method, or the TXMLXSDExport component.

License

The fpXMLXSDExport module is freeware, licensed under the MIT license: all use free, but no liability accepted. It is also licensed under the license used for the FreePascal Free Component Library (FCL), so take your pick.

See also


From the Free Pascal wiki, page "fpXMLXSDExport", as it stood on 2017-06-30 after a change by E-ric, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .