Recent

Author Topic: using xml  (Read 1544 times)

BlueIcaro

  • Hero Member
  • *****
  • Posts: 827
    • Blog personal
Re: using xml
« Reply #15 on: March 03, 2025, 07:34:55 pm »
Hello, I tested in Lazarus 4.0RC, and I have not problem
Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
var
  XmlDoc: TXMLDocument;
  Root: TDOMElement;
begin
  XmlDoc := TXMLDocument.Create;
  Root := XmlDoc.CreateElement('catalogocuentas:Catalogo');
  Root.AttribStrings['aa']:='ggg';     

Which Lazarus did use? and Operating System?
/BlueIcaro

rcmz

  • Full Member
  • ***
  • Posts: 156
Re: using xml
« Reply #16 on: March 03, 2025, 08:38:42 pm »
Hi,

Im using Lazarus 3.0

TIA
Ramiro

rcmz

  • Full Member
  • ***
  • Posts: 156
Re: using xml
« Reply #17 on: March 03, 2025, 09:07:43 pm »
hi, again

I just installed version 3.8

Im still having the problem with

Root.AttribStrings  "error: identifier idents no member AttribStrings"

how can i correct this error.

TIA
Ramiro

VisualLab

  • Hero Member
  • *****
  • Posts: 693
Re: using xml
« Reply #18 on: March 03, 2025, 09:54:46 pm »
Hmm... The documentation says that "AttribStrings" does exist as an array property on the TDOMElement class. This documentation:

TDOMElement
TDOMElement.AttribStrings

The simple example provided by BlueIcaro compiles for me (Windows 10 64-bit, Lazarus 3.4). Maybe you declared something incorrectly?

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: using xml
« Reply #19 on: March 03, 2025, 10:32:12 pm »
In case rcmz is using his last posted example without any modification then that is no wonder. The rootnode in that code is a TDomNode (which does not have attribstrings property).

BTW the attribstrings property is default so
Code: Pascal  [Select][+][-]
  1. MyElement['name'] := 'value';
  2.  
Should suffice as well.

PS: @rcmz even works as expected on Lazarus 3.4 (for me the quickest older version I was able to grab) so you should have no issues. Tried and tested with dsider's example.
Code: XML  [Select][+][-]
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <catalogocuentas:Catalogo xmlns:catalogocuentas="http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas http://www.sat.gob.mx/esquemas/ContabilidadE/1_3/CatalogoCuentas/CatalogoCuentas_1_3.xsd" Version="1.3" RFC="ROAP640729JZ5" Mes="02" Anio="2025">
  3.   <catalogocuentas:Ctas CodAgrup="101.01" NumCta="100-000-000" Desc="FONDO FIJO DE CAJA" Nivel="1" Natur="D"/>
  4.   <catalogocuentas:Ctas CodAgrup="102.01" NumCta="100-000-000" Desc="BANCOMER SA DE CV" Nivel="1" Natur="D"/>
  5. </catalogocuentas:Catalogo>
  6.  

fwiw: the XML dom from FPC indeed seem to put/retrieve/store the attributes in another order.
« Last Edit: March 03, 2025, 11:03:39 pm by TRon »
Today is tomorrow's yesterday.

rcmz

  • Full Member
  • ***
  • Posts: 156
Re: using xml
« Reply #20 on: March 03, 2025, 11:18:18 pm »
hi,

sorry I just change from TDOMNode to TDOMElement

the file is created as required.

Thx to all
Ramiro

 

TinyPortal © 2005-2018