I am basing the following guess on the only FreeCellSettings.xml file I have to work with, so I may be way off, but it looks to me like the offset to the XML data is stored at byte 8 of the file, and then the XML data begins with a 32-bit value representing its length. Try this, it works on my file:

#!/usr/bin/env perl use warnings; use strict; use open qw/:std :utf8/; open my $fh, '<:raw', 'FreeCellSettings.xml' or die $!; seek $fh, 8, 0 or die; read($fh, my $off, 4) == 4 or die; $off = unpack 'V', $off; printf STDERR "Offset: 0x%X\n", $off; seek $fh, $off, 0 or die; read($fh, my $len, 4) == 4 or die; $len = unpack 'V', $len; printf STDERR "Length: 0x%X\n", $len; my $act_len = read($fh, my $data, $len); printf STDERR "Actually read 0x%X bytes\n", $act_len; warn "WARNING: Differing lengths, expected $len, actual $act_len" unless $act_len==$len; close $fh; use Encode qw/decode FB_CROAK/; my $xml = decode("UTF-16LE", $data, FB_CROAK); print $xml;

In reply to Re: Extract data from non-standard .xml file by Anonymous Monk
in thread Extract data from non-standard .xml file by BillKSmith

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.