Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-01

Strange issue with TXMLConfig

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darius Blaszyk

All of a sudden I get a crash in my app trying to read a path from an XML file. The crash comes from the function TDOMNamedNodeMap.Find that crashes on this line:

C := TDOMNode(FList.List^[I]).CompareName(name);

The strange thing is that a simplified example app does not crash! In any case I'm 100% sure the path exists and either way even if it didn't XMLConfig should not crash. The message form the lazarus code inspector is: Type TDOMNODE has no component named COMPARENAME.The code also never reaches the CompareName function when I set a breakpoint.

I'm at a loss. Is any one capable to understand what is happening?

Rgds, Darius

My code is:

    c := cache.GetValue('filelist/item_1/crc', 0);

The XML is:

<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
<filelist type="filecache" count="1">
<item_1 crc="30150" filename="C:\myfile.txt"/>
</filelist>
</CONFIG>

The BT is:

An unhandled exception occurred at $0000000100033BA4: EAccessViolation: Access violation
$0000000100033BA4 line 1783 of fcl-xml/src/dom.pp
$0000000100033C75 line 1802 of fcl-xml/src/dom.pp
$000000010003707D line 3159 of fcl-xml/src/dom.pp
$000000010002EC28 line 195 of xmlconf.pp

Reply by email

Vojtěch Čihák

Hi, I can only say that TDOMNode from Laz2_DOM in trunk has function CompareName.  
V.
______________________________________________________________

Show quoted text 5 lines
Od: Darius Blaszyk Komu: FPC-Pascal users discussions Datum: 18.01.2018 00:11 Předmět: [fpc-pascal] Strange issue with TXMLConfig

All of a sudden I get a crash in my app trying to read a path from an XML file. The crash comes from the function TDOMNamedNodeMap.Find that crashes on this line: 

C := TDOMNode(FList.List^[I]).CompareName(name);

The strange thing is that a simplified example app does not crash! In any case I'm 100% sure the path exists and either way even if it didn't XMLConfig should not crash. The message form the lazarus code inspector is: Type TDOMNODE has no component named COMPARENAME.The code also never reaches the CompareName function when I set a breakpoint.

I'm at a loss. Is any one capable to understand what is happening?

Rgds, Darius

My code is:

    c := cache.GetValue('filelist/item_1/crc', 0);

The XML is:

<?xml version="1.0" encoding="utf-8"?>
<CONFIG>
  <filelist type="filecache" count="1">
    <item_1 crc="30150" filename="C:\myfile.txt"/>   </filelist>
</CONFIG>

The BT is:

An unhandled exception occurred at $0000000100033BA4: EAccessViolation: Access violation
  $0000000100033BA4 line 1783 of fcl-xml/src/dom.pp   $0000000100033C75 line 1802 of fcl-xml/src/dom.pp   $000000010003707D line 3159 of fcl-xml/src/dom.pp   $000000010002EC28 line 195 of xmlconf.pp

----------

Reply by email

Vojtěch Čihák

The second TDOMNode from unit DOM (fcl-xml) has that function too, in FPC 3.0.4. V.
______________________________________________________________

Show quoted text 5 lines
Od: Vojtěch Čihák Komu: FPC-Pascal users discussions Datum: 18.01.2018 00:30 Předmět: Re: [fpc-pascal] Strange issue with TXMLConfig

Hi, I can only say that TDOMNode from Laz2_DOM in trunk has function CompareName.  
V.
______________________________________________________________

Show quoted text 5 lines
Od: Darius Blaszyk Komu: FPC-Pascal users discussions Datum: 18.01.2018 00:11 Předmět: [fpc-pascal] Strange issue with TXMLConfig

----------

Reply by email

Vojtěch Čihák
to Vojtěch Čihák: The second TDOMNode from unit DOM (fcl-xml) has that function too, in FPC 3.0.4. V.…

Hmm, I remember there are two ways how to work with XML: Laz2_xxx and fcl-xml. My idea was that you got some wrong TDOMNode in the path. V.
______________________________________________________________

Show quoted text 7 lines
Od: Darius Blaszyk Komu: FPC-Pascal users discussions Datum: 18.01.2018 20:31 Předmět: Re: [fpc-pascal] Strange issue with TXMLConfig Hi, I can only say that TDOMNode from Laz2_DOM in trunk has function CompareName.

I'm using FPC 3.0.4 indeed. No dependency to the LCL.

Darius

Reply by email