[Lazarus] Xml

farcodev at users.sourceforge.net farcodev at users.sourceforge.net
Tue Oct 7 18:57:47 CEST 2008


i have a light problem with xml.
here my code:

    {.create the document}
    CFWxmlFile:=TXMLDocument.Create;
    {.create the root node of the configuration file}
    CFWxmlRoot:=CFWxmlFile.CreateElement('configfile');
    CFWxmlFile.AppendChild(CFWxmlRoot);

    {.create the config item "locale"}
    CFWxmlRoot:=CFWxmlFile.DocumentElement;
    CFWxmlCfgItm:=CFWxmlFile.CreateElement('locale');
    TDOMElement(CFWxmlCfgItm).SetAttribute('lang',NSJLang);
    CFWxmlRoot.AppendChild(CFWxmlCfgItm);
    {.write the file and free the memory}
    WriteXMLFile(CFWxmlFile,NSJPathCfg);
    CFWxmlFile.Free;

the result is ok except for formatting:

<?xml version="1.0"?>
<configfile><locale lang="EN"/></configfile>

What i missed for have:

<?xml version="1.0"?>
<configfile>
    <locale lang="EN"/>
</configfile>

thanks in advance ! :)

Graeme Geldenhuys wrote:
> On Sun, Oct 5, 2008 at 8:50 PM, eak <eak at eakcorp.net> wrote:
>> how to use xml with lazarus , i don't find document or i found it
>> complex document and i don't understand.
> 
> The question is rather: "What do you want to do with XML?"  Save
> application settings, export/import data etc...
> 
> 
> 
> Regards,
>   - Graeme -
> 
> 
> _______________________________________________
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> 




More information about the Lazarus mailing list