Results 1 to 4 of 4

Thread: How to extract xml file generated by Grisbi

  1. #1
    Join Date
    Jan 2009
    Posts
    88

    How to extract xml file generated by Grisbi

    For those who know the software, I use Grisbi for my accounts. I want to extract the xml file generated by Grisbi of my accounts balances and this command line.

    xml file looks like this:
    <Accounts>
    <Account>
    ...
    <Balance_current> 99999999 <Balance_current>
    ...
    </Account>
    ...
    </Accounts>

    I found as xmllint utility, but I did not think it meets my necessities. If you have an idea then do help me!

  2. #2
    Join Date
    May 2008
    Posts
    3,971

    Re: How to extract xml file generated by Grisbi

    The shell is not the best way to extract info from a XML file. Perl is much more responsive, and it is rather simple (XML:: Simple same). Here is a simple example that you can just copy paste it into a (pseudo) terminal:

    Code:
    cat > /tmp/l.xml <<WTF
    <?xml version="1.0" ?>
    <!DOCTYPE Foobar>
    <Foobar Version="1.0">
        <Accounts>
            <Account>
                <Balance_current>99999999</Balance_current>
            </Account>
        </Accounts>
    </Foobar>
    WTF
    perl -MXML::Simple -e '$c = XMLin("/tmp/l.xml" ); print $c->{Accounts}->{Account}->{Balance_current}, "\n";'
    If you know perl, you just install this module if needed with the command:

    Code:
    # cpan -i XML::Simple
    OR

    Code:
    perldoc XML::Simple

  3. #3
    Join Date
    Jan 2009
    Posts
    88

    Re: How to extract xml file generated by Grisbi

    I thought of perl but then my xml file is like this:
    <? xml version = "1.0"?>
    <Grisbi>

    and not this:

    <? xml version = "1.0"?>
    <! DOCTYPE Foobar>
    <Foobar Version="1.0">

    The other problem is that if I have multiple accounts I have this error: Not a HASH reference at -e line 1.

    I think we should manage it in perl.

  4. #4
    Join Date
    May 2008
    Posts
    3,971

    Re: How to extract xml file generated by Grisbi

    Consequently, you do not want to look

    Code:
    cat > /tmp/l.xml <<RTFM
    <?xml version="1.0" ?>
    <Grisbi>
        <Accounts>
            <Account>
                <Balance_current>3,50$</Balance_current>
            </Account>
        </Accounts>
    </Grisbi>
    RTFM
    perl -MXML::Simple -e '$c = XMLin("/tmp/l.xml" ); print $c->{Accounts}->{Account}->[1]->{Balance_current} ."\n";'

Similar Threads

  1. How to extract .TAR.XZ file
    By Gaural in forum Windows Software
    Replies: 5
    Last Post: 18-01-2013, 07:08 PM
  2. Avira Antivirus detects java generated text file as HTML/Silly.Gen
    By ROcHANn in forum Networking & Security
    Replies: 5
    Last Post: 01-06-2011, 10:50 AM
  3. How to use Kaspersky Anti virus to generated trace log file
    By Kallol in forum Networking & Security
    Replies: 5
    Last Post: 30-03-2010, 01:49 AM
  4. Access a file generated by server
    By Ash maker in forum Software Development
    Replies: 5
    Last Post: 25-01-2010, 02:45 PM
  5. How to extract a ape file
    By geokilla in forum Windows Software
    Replies: 3
    Last Post: 26-08-2009, 12:27 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,752,101,891.02724 seconds with 16 queries