[fpc-pascal] Strange issue with TXMLConfig

Darius Blaszyk dhkblaszyk at zeelandnet.nl
Thu Jan 18 00:11:17 CET 2018


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180118/f00df82c/attachment.html>


More information about the fpc-pascal mailing list