[fpc-pascal] ReadXMLFile() fails reading a xml file

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Feb 2 09:35:05 CET 2010


Hi,

Part of creating a new cross-platform installer application, I'm trying to
read an XML file that contains UTF-8 characters, but I get the following
error. Unicode support is very important, because the setup program must
support multiple languages. Does this mean the XML implementation in FPC
doesn't support Unicode enabled XML at all?  :-(


  // that reads the xml file
  ReadXMLFile(doc, './setup.xml');   //  <<-- Fails on this line!
  if not Assigned(doc) then
    exit;


---------------------------------------------
$ ./setup_gui
DEBUG:  TMainForm.FormShow >>
DEBUG:  TMainForm.PopulateInstallOptions >>
An unhandled exception occurred at $000000000050E277 :
EXMLReadError : In 'file:./setup.xml' (line 23 pos 20): Invalid character
in input stream
  $000000000050E277 line 1298 of src/xmlread.pp
  $000000000050E12B line 1270 of src/xmlread.pp
  $000000000050DF6E line 1252 of src/xmlread.pp
  $00000000005161F4 line 3735 of src/xmlread.pp
  $0000000000516361 line 3754 of src/xmlread.pp
  $000000000046847B line 185 of frm_main.pas
  $0000000000467DEE line 66 of frm_main.pas
  $00000000004679DB line 350 of ../../gui/fpg_form.pas
  $00000000004676D8 line 287 of ../../gui/fpg_form.pas
  $000000000041D1CE line 22 of setup_gui.lpr
  $000000000041D216 line 30 of setup_gui.lpr
---------------------------------------------


Here is a snippet of the XML file I'm trying to read
-------------[ setup.xml ]--------------------
<?xml version="1.0" standalone="yes"?>
<install product="SC3U" desc="SimCity 3000 Unlimited" version="2.0">
  <readme>
   README
  </readme>
  <readme lang="fr">
   README.fr
  </readme>
  <readme lang="de">
   README.de
  </readme>
  <readme lang="es">
   README.es
  </readme>
  <readme lang="sv">
   README.sv
  </readme>
  <option install="true" required="true">
  Base Install
  <lang lang="fr">Installation de base</lang>
  <lang lang="sv">Basinstallation</lang>
  <lang lang="it">Installazione Minima</lang>
  <lang lang="es">Básica Instalación</lang>
  <lang lang="de">Basisinstallation</lang>
  <lang lang="nl">Basis-installatie</lang>
  <help>Required for play</help>
  <help lang="fr">Requis pour jouer</help>
  <help lang="sv">Filer som behövs för att spela</help>
  <help lang="it">Richieste Software</help>
  <help lang="es">Requerido para el juego</help>
  <help lang="de">Zum Spielen benötigt</help>
  <help lang="nl">Vereist voor het spel</help>
...
----------------------------------------------


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/




More information about the fpc-pascal mailing list