[Lazarus] How to get the package version from a LPK file?

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Nov 29 16:35:01 CET 2011

On 29/11/2011, Michael Van Canneyt <michael.vancanneyt at ......be> wrote:
> No sweat... DOM is really easy, once you know how it works.

I'm learning. :)

There are  couple of pitfalls obviously, as noted by this post to the
fpc-pascal mailing list.


I'm not sure if the difference between Delphi and FPC still exist.

The other tricky thing was the "hidden text node", and the leaf node
that has an "invisible" NodeValue property, but no way of writing that
value out to a XML file.


    { The FPC DOM way... }
    n := doc.DocumentElement.FirstChild.FirstChild.NodeName;
    v := doc.DocumentElement.FirstChild.FirstChild.FirstChild.NodeValue;
    writeln(Format('n = %s    v = %s', [n, v]));

    { The FPC DOM way... }
    n := doc.DocumentElement.FirstChild.FirstChild.NodeName;
    v := doc.DocumentElement.FirstChild.FirstChild.TextContent;
    writeln(Format('n = %s    v = %s', [n, v]));

I got this now. Both the above examples produce the same output. But
where in the XML is the following stored?

    n := doc.DocumentElement.FirstChild.FirstChild.NodeValue;

This always returns a empty string.

I'm using the following XML sample

<?xml version="1.0" encoding="UTF-8"?>
<BAIS_XML Version='1.0'>
    <RESPOND_TIME>2005.01.20 12:26:58</RESPOND_TIME>
    <REQUEST_TIME>2005.01.20 12:26:58</REQUEST_TIME>
    <USER ID="simba">
      <GROUP ID="1">Operator bank</GROUP>
      <NAME>Bisma Jayadi</NAME>
    <LOCATION ID="1">
      <NAME>Komputer Bisma</NAME>

I also had to Google the meaning or difference between a XML Node and
an XML Element. I hate XML! :)

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list