: RE : [fpc-pascal] Patch: new XML export forFCL-DB, was: SDFDataset multiline support: request for a look at patch+test, issue 17285

Ludo Brands ludo.brands at free.fr
Sat Jul 23 16:41:42 CEST 2011



> > Isn't property FormatSettings: TXMLXSDFormatSettings supposed to be 
> > used for this? It has a Property DecimalSeparator.
> > 
> > Ludo
> I think we may misunderstand one another.
> 
> What I propose:
> 1. do NOT localize decimal separator in XML output, but keep 
> US format . This has the advantage that export of the same 
> data on any system will lead to the same results. 
> (Disadvantage: Access might barf if a decimal , is suddenly a 
> decimal .)
> 
> There are 2 more options:
> 2. Localize decimal separator according to OS locale settings 
> such as Access XP is doing. 3. Follow the FormatSettings 
> setting given in the GUI to determine output type. (Or a 
> combination of these)
> 

OK let me more precise:

Change

  function TCustomXMLXSDExporter.CreateFormatSettings:
TCustomExportFormatSettings;

To

  function TCustomXMLXSDExporter.CreateFormatSettings:
TCustomExportFormatSettings;
  begin
    Result := TXMLXSDFormatSettings.Create(True);
  end;

This will initialise Formatsetting to sysutils format settings.

In procedure TCustomXMLXSDExporter.DoBeforeExecute;

  SysUtils.FormatSettings.DecimalSeparator :=
FormatSettings.DecimalSeparator;

This will give you option 2 if you don't change
TCustomXMLXSDExporter.FormatSettings and option 1 if you do override the
settings. IMHO the default should be that the system that creates the file
can also open it.  


> In cases 1 and 3, I might need to customize the decimal 
> separator for float export. This means (as far as I have been 
> able to find out) tweaking the Sysutils.Formatsettings... Right?
> 

yes

> In any event, I'll first try and see what newer versions of 
> Access and ADO.NET do...
> 

As you have probably already figured out, ADO.NET XML and Access 2002 XML
aren't compatible. Files created by one can't be read by the other. ADO.NET
breaks on the schemaname and suggest  http://www.w3.org/2001/XMLSchema .
Access can't read the table schema and imports everything as text.

Seems decimal separators are only a minor detail... 

Ludo





More information about the fpc-pascal mailing list