Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read SiteMap

Tags: , ,

Sponsored Links



How to extract xml file generated by Grisbi

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 06-05-2009
Member
 
Join Date: Jan 2009
Posts: 83
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!
Reply With Quote
  #2  
Old 06-05-2009
switchblade327's Avatar
Member
 
Join Date: May 2008
Posts: 3,998
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
Reply With Quote
  #3  
Old 06-05-2009
Member
 
Join Date: Jan 2009
Posts: 83
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.
Reply With Quote
  #4  
Old 06-05-2009
switchblade327's Avatar
Member
 
Join Date: May 2008
Posts: 3,998
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";'
Reply With Quote
Reply

  TechArena Community > Software > Software Development


Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to extract xml file generated by Grisbi"
Thread Thread Starter Forum Replies Last Post
Avira Antivirus detects java generated text file as HTML/Silly.Gen ROcHANn Networking & Security 5 01-06-2011 11:50 AM
How to use Kaspersky Anti virus to generated trace log file Kallol Networking & Security 5 30-03-2010 02:49 AM
Access a file generated by server Ash maker Software Development 5 25-01-2010 02:45 PM
How to extract a ape file geokilla Windows Software 3 26-08-2009 01:27 PM
How to extract sfv file King Leonidas Windows Software 2 18-06-2009 11:28 AM


All times are GMT +5.5. The time now is 05:25 AM.