using xml to save/open project data
- From: tonytraductor <photodharma@xxxxxxxxx>
- Date: Wed, 5 Mar 2008 08:21:23 -0800 (PST)
Hi,
This is my first post to this list, so, I hope I am within the bounds
of the group. I'm a newbie to programming, and enjoying
tcl very much, but likely to ask stupid questions.
Now, I've made a program, a translation project management tool,
and, I've got it doing almost everything I want.
(I just started learning tcl in January, when I started
to write this program).
http://www.TransProCalc.org - Free translation project mgmt software
Really, it's a very simple program, a gui interface that collects
specific data regarding a project (how many documents, how many
words, how much to charge per word, to whom documents have been
assigned,
etc., etc.) and spits out reports. It helps me manage this data
and does a little math. Simple.
But, there are a few, more or less essential, functions that
I still want to add.
1) rounding financial figures.
This is proving quite troublesome.
I can only find information for rounding to integers, and I need to
round to hundredths/cents.
2)giving the user the ability to add/remove fields for
items like no. of document, languages, vendors, expenses, etc.
I think that's going to be complicated, so, I haven't quite
looked into that yet, although, I'm certain it's possible
and will get around to that eventually.
At the moment it serves my purposes, I just want this function to make
it more useful to others.
and
3) saving/re-opening of project. (It makes these reports,
will print and save them, but,
if I want to manipulate this same data later,
I have to re-input all of the data.)
It is this last for which I am seeking a bit of assistance at the
moment.
I tried just having the program write a script
puts "/usr/bin/wish\n
set var value\n
set var1 value1\n
etc.\n"
Then did
set filename tk_getOpenfile
exec $filename
to run the script to reset the variables to reopen the project.
Didn't work. The script would run, but the values weren't
imported to my program. The script would run and exit,
and, I'm assuming, somewhere those vars were set, but,
not in tpcalc. So, I lumped that.
Besides, I had to chmod the script by hand, because I couldn't
get my program to effect that little necessary change,
and that's not going to be too useful to other users, is it?
I've been told that generating an xml file is the best way to go about
this,
and, generating the xml file is easy enough. I can just have
transprocalc
write that file like it does the reports it currently writes.
No problem.
But reading the file to set the variables to re-open a save project is
proving
troublesome.
If I understand this (from http://tclxml.sourceforge.net/tclxml/3.1/tclxml.html):
I can write a proc that will do something like:
package require xml
ttk::button .btn -text Open -command open
proc open {target, data} {
set parser [xml::parser -processinginstructioncommand setvars]
setvars {set filename tk_getOpenfile
{
for each i in $filename do
set target data
}
}
}
Or something akin to that.
Where filename is the name of the xml file,
target is the element and data the value, like
[target] data [/target]
[target1] data1 [/target1]
in the xml file ($filename).
Am I way off here?
I'm figuring a lot of stuff out by trial/error and whatnot, but,
confess,
that some of these tutorials are starting over my head with language
I don't understand. (It's like man pages...8 years of using linux, and
still,
most man pages might as well be in Chinese, as far as I'm concerned...
and I don't speak Chinese, just English, French, Spanish and
Portuguese...)
This xml documentation would be among those.
If this is not the appropriate place for a newbie to ask
stupid questions, I apologize, and would be grateful for
any direction regarding where I may ask said stupid questions.
Thanks,
Tony
--
http://www.LinguasOS.org - Linux for Translators
http://www.BaldwinLinguas.com - translating & interpreting
http://www.TransProCalc.org - Free translation project mgmt software
.
- Follow-Ups:
- Re: using xml to save/open project data
- From: Larry W. Virden
- Re: using xml to save/open project data
- From: Simon Bachmann
- Re: using xml to save/open project data
- From: Neil Madden
- Re: using xml to save/open project data
- From: schlenk
- Re: using xml to save/open project data
- Prev by Date: Re: string trim not trimming special space characters
- Next by Date: Keyword replace except within quotes
- Previous by thread: registry package + windows x64 [tcl8.4.13]
- Next by thread: Re: using xml to save/open project data
- Index(es):