f



read an XML file in TCL

Hello
  I am looking to read an XML file into my TCL program and extract
information. How do we read an XML file in TCL? Are there man pages
that describe these?

Thanks
krithiga

0
krithiga81 (141)
1/20/2006 5:53:37 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

8 Replies
667 Views

Similar Articles

[PageSpeed] 13

one way is:

http://wiki.tcl.tk/tdom

0
1/20/2006 7:11:55 PM
another (and faster, but should be used only for valid stuff) is

http://wiki.tcl.tk/11020

0
Nite4Hawks (25)
1/20/2006 7:22:30 PM
Torsten Edler wrote:
> another (and faster, but should be used only for valid stuff) is
> 

I'm curious as to this assertion that the shallow regexp parser is 
faster than tdom, I would have expected things to be the other way 
around. Do you have a benchmark? Were you testing tdom building a DOM 
tree or just SAX parsing (the latter would be a fairer comparison)?

My own brief benchmark (parsing the XML 1.0 spec, ~200KB) produced these 
results:

proc ParseXMLRegexp xml {
     XML::Init $xml
     while 1 {
         lassign [XML::NextToken] type val attr etype
         if {$type eq "EOF"} { break }
     }
}
proc ParseXMLTdom xml {
     dom parse $xml doc
}
puts "Regexp: [time { ParseXMLRegexp $xml } 10]"
puts "Tdom:   [time { ParseXMLTdom $xml } 10]"

output:
Regexp: 2419835.7 microseconds per iteration
Tdom:   52872.1 microseconds per iteration

which makes tdom roughly 45X faster than the regular expression parser, 
and that's with tdom building and destroying a full DOM tree.

-- Neil
0
nem3909 (999)
1/21/2006 3:31:08 PM
Hi Neil,

i typed my answer a bit too fast and mixed up TclXML with TcLDOM.

Few months ago i had to read and extract all data from an XML-file. The
file was an export of an MS-Access table with 17000 records with
roughly 50 columns and a total of 16 Mbyte size. (aside: why not use
CSV files - memo fields with lots of funny characters). Basically i
wanted to import the data from Access to Oracle-DB (aside: there are
other and much faster ways but in the time frame given, this was may
first try, later i did it with tclodbc).

So my task was beyond "parsing" it was also "extracting" from the file
(which i guess is also the OPs task at hand). I started out with TclXML
and it proved to be very slow. So searching the TCL-wiki for XML i
found references to TclDOM and the page i mentioned.

I have to admit i was not at all interested in learning DOM, XML and
all the techniques around it, i just wanted to get my data out of that
file (even considered regex-ing myself). So i decided for the little
nifty interface of the script. The documentation for DOM and a little
sentence in the ActiveTcl help files

<<The DOM specification should be read in conjunction with this
reference manual, as it explains the meaning and purpose of the various
interfaces. This manual is not a tutorial on how to use the DOM>>

already gave me the creeps as i was short on time and therefore not
willing to look at too many docs.

So actually i am not able to say whether TclDOM will run faster or
slower. But when it comes to "learning time" and dodging the complexity
of TclDOM, i would still decide the same.

0
Nite4Hawks (25)
1/21/2006 4:44:14 PM
krithiga81@yahoo.com wrote:
>   I am looking to read an XML file into my TCL program and extract
> information. How do we read an XML file in TCL? Are there man pages
> that describe these?

Basically, there are three ways to do this:

1. as a stream of data (faster, uses less memory, but requires you to
write more code),
2. as a tree of nodes (ie. DOM; not-so-fast, uses a lot of memory, but
good when you have to make multiple passes over the data and/or need to
analyse the document's structure),
3. using XSLT (generally most useful when you have to produce a
corresponding output document - if you are extracting data for use in
your Tcl program then this option would only be for advanced users ;-)
)

For option 1 you would use SAX (or something like it).  TclXML provides
this level of interface.

For option 2 you would use DOM.  TclDOM provides this level of
interface.

For option 3 you would use TclXSLT.

For documentation and man pages on these three packages see
http://tclxml.sf.net/.

HTHs,
Steve Ball

0
Steve.Ball (89)
1/22/2006 11:59:32 PM
Torsten Edler wrote:
> Hi Neil,
> 
....
> I have to admit i was not at all interested in learning DOM, XML and
> all the techniques around it, i just wanted to get my data out of that
> file (even considered regex-ing myself). 

A very sane attitude to take! :-)

> So i decided for the little
> nifty interface of the script. The documentation for DOM and a little
> sentence in the ActiveTcl help files
> 
> <<The DOM specification should be read in conjunction with this
> reference manual, as it explains the meaning and purpose of the various
> interfaces. This manual is not a tutorial on how to use the DOM>>
> 
> already gave me the creeps as i was short on time and therefore not
> willing to look at too many docs.

That's understandable. However, building a DOM tree is only one option. 
There is also a SAX-style interface (SAX = Simple API for XML) which 
both tdom and TclXML provide, where you get a series of events as a 
document is parsed that you can respond to. The regexp shallow parser on 
the wiki is another separate technique.

> 
> So actually i am not able to say whether TclDOM will run faster or
> slower. But when it comes to "learning time" and dodging the complexity
> of TclDOM, i would still decide the same.

Just to clear up, there are 2 main "vendors" (for want of a better word) 
of XML processing packages for Tcl:

* The TclXML/TclDOM/TclXSLT project (http://tclxml.sourceforge.net/);
* The tDOM project (http://www.tdom.org/).

Both projects provide roughly the same functionality:

* A SAX event-based stream parser (fast, lightweight);
* A DOM tree parser (holds entire doc in memory, flexible);
* An XPath expression engine, for querying DOM trees;
* An XSLT processor for transforming DOM trees using an XML-based 
declarative transformation language (XSLT);
* Some sort of easy XML-generation library (xmlgen vs. tdom's 
createNodeCmd).

There are other bits and pieces, but those are the most fundamental 
technologies that people doing much XML work should be aware of. In 
tDOM, these are all just part of the one package. In TclXML the 
technologies are broken into separate packages: TclXML (SAX), TclDOM 
(DOM), TclXSLT (well, you get the picture :). The TclXML project also 
hosts a number of different implementations such as a pure-Tcl version 
and versions based on the Gnome libxml stuff.

Now, next to all this is the regexp shallow parser on the wiki which is 
an entirely different approach. If it worked for you, great! However, 
the general advice to someone new to XML processing with Tcl would be to 
check out one of the above projects, which are known to work well and 
conform to the XML specifications. I certainly understand a reaction 
against the complexity and jargon surrounding XML technologies and just 
wanting to get things done. However, using a basic SAX parser isn't too 
difficult. For example, see http://wiki.tcl.tk/2741 .

Cheers,

-- Neil
0
nem3909 (999)
1/23/2006 3:18:53 PM
Hi Neil
    In the proc dom for xml where is the xml file specified. Is it the
argument to the procedure or should the xml file be reads as file open
and set to a variable?

Thanks
kc
Neil Madden wrote:
> Torsten Edler wrote:
> > another (and faster, but should be used only for valid stuff) is
> >
>
> I'm curious as to this assertion that the shallow regexp parser is
> faster than tdom, I would have expected things to be the other way
> around. Do you have a benchmark? Were you testing tdom building a DOM
> tree or just SAX parsing (the latter would be a fairer comparison)?
>
> My own brief benchmark (parsing the XML 1.0 spec, ~200KB) produced these
> results:
>
> proc ParseXMLRegexp xml {
>      XML::Init $xml
>      while 1 {
>          lassign [XML::NextToken] type val attr etype
>          if {$type eq "EOF"} { break }
>      }
> }
> proc ParseXMLTdom xml {
>      dom parse $xml doc
> }
> puts "Regexp: [time { ParseXMLRegexp $xml } 10]"
> puts "Tdom:   [time { ParseXMLTdom $xml } 10]"
>
> output:
> Regexp: 2419835.7 microseconds per iteration
> Tdom:   52872.1 microseconds per iteration
>
> which makes tdom roughly 45X faster than the regular expression parser,
> and that's with tdom building and destroying a full DOM tree.
> 
> -- Neil

0
krithiga81 (141)
1/23/2006 7:26:52 PM
krithiga81@yahoo.com wrote:
> Hi Neil
>     In the proc dom for xml where is the xml file specified. Is it the
> argument to the procedure or should the xml file be reads as file open
> and set to a variable?

In the test I ran, the XML was read into a variable:

proc readfile file {
     set fid [open $file]
     set xml [read $fid]
     close $fid
     return $xml
}
set xml [readfile somexmlfile.xml]
ParseXMLTdom $xml

etc..

That's not ideal as it doesn't handle XML encodings etc properly. tDOM 
has a [tDOM::xmlReadFile] that you can use, and there are other options 
for dealing with channels etc.

-- Neil
0
nem3909 (999)
1/23/2006 9:05:28 PM
Reply:

Similar Artilces:

TCL/PHP/XML problem: I need to convert an XML file into a TCL list
My TCL proc, XML_GET_ALL_ELEMENT_ATTRS, is supposed to convert an XML file into a TCL list as follows: attr1 {val1} attr2 {val2} ... attrN {valN} This is the TCL code that does this: [TCL] set contents [read $fileID [file size ${fileName}.xml]]; close $fileID if {![string equal $switch -body]} { # ONLY DO THIS IF THE XML CONTENTS CONTAIN NO BODY - WILL UPGRADE AT A LATER DATE 11/24/2006 - PHIL global serverName if {![info exists serverName]} { global env source ./cgi_globals.tcl global serverName } if {[string length [info procs {URL_ENCODE}]] == 0} { source...

Sourcing a TCL file from within a tcl file
I am a newbie which I am sure I don't need to state :) I am trying to create a variable with a TCL file that will source another tcl file when I type the variable name something like this if I enter A through my keyboard then source a.tcl Can someone show me how to do this thanks guy On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > I am a newbie which I am sure I don't need to state :) > > I am trying to create a variable with a TCL file that will source > another tcl file when I type the variable name > > something like this > > if I enter A through my keyboard =A0then source a.tcl > > Can someone show me how to do this > > thanks > guy What you are asking is not hard. Will your program have a graphical user interface? Aric On Dec 10, 3:26=A0pm, Aric Bills <aric.bi...@gmail.com> wrote: > On Dec 10, 1:15=A0pm, guy <gcoletta2...@gmail.com> wrote: > > > I am a newbie which I am sure I don't need to state :) > > > I am trying to create a variable with a TCL file that will source > > another tcl file when I type the variable name > > > something like this > > > if I enter A through my keyboard =A0then source a.tcl > > > Can someone show me how to do this > > > thanks > > guy > > What you are asking is not hard. =A0Will your program have a graphical > user interface? > > Aric no I am just using this script...

How to write tcl generated xml file into a new file
Hi, I have generated a xml file using xmlgen. After running the tcl script the ouput is displayed on the terminal . I want to take the terminal output into a xml file. Any Suggestion ???/ Thanks Ranjan On Nov 25, 12:46=A0pm, gyana behera <ranjan....@gmail.com> wrote: > Hi, > > I have generated a xml file using xmlgen. > After running the tcl script the ouput is displayed on the terminal . > I want to take the terminal output into a xml file. > > Any Suggestion ???/ > > Thanks > Ranjan Either redirect the output of the script to the xml-file. (xmlgen > output.xml) or open the file in the script: set f [open $filename w] then use puts $f instead of puts to output to the file and finally close the file: close $f Note that all this is covered in the Tcl tutorial, which is definitely worth a visit. (http://www.tcl.tk/man/tcl8.5/tutorial/ tcltutorial.html) Mark ...

read file in tcl
how to read or call a file in tcl ? davidw@dedasys.com (David N. Welton) wrote in message news:<873cg837s7.fsf@dedasys.com>... > prowarcraftplayer@yahoo.com (K Zewi) writes: > > > how to read or call a file in tcl ? > > 'call' a file? > > Reading a file can be done with the 'read' command: > > set fl [open "somefile"] > set data [read $fl] > > is a simple way to do it. You want to look at the documents for those > commands, and maybe 'fconfigure' if you want to read a binary file. i still can't read ...

how to read file in tcl
in the condition that giving some coordinate of polygon in a directory and i have to read these file without using the command create poly how to call these file from the directory? In article <36940419.0308110031.66a5cd1@posting.google.com>, K Zewi <prowarcraftplayer@yahoo.com> wrote: >in the condition that >giving some coordinate of polygon >in a directory and i have to >read these file without using >the command create poly >how to call these file >from the directory? Did you ever get the help you sought? My guess is that readers found your question...

tcl-gaul: Genetic Algorithms for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-gaul Tcl-gaul is a Tcl extension for genetic/evolutionary algorithm processing.It relies on the GAUL library: http://gaul.sourceforge.net/ * A genetic algorithm (GA) is a search technique used in computing to find exact or approximate solutions to optimization and search problems. Genetic algorithms are categorized as global search heuristics. They are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover. For an introduction to genetic algorithms visit: http://gaul.sourceforge.net/intro.html Platform: Linux (GAUL library dependency) Home page: http://sourceforge.net/projects/tcl-gaul/ Man page: http://tcl-gaul.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

tcl code to read an image and write tcl code?
Does anyone know where I can find a tcl proc that would take an image, say a gif, and output pure tcl code that I could paste into a program? I saw something about a unix program that did something with mimes but I'm on windows. In article <4403BC94.447A7341@rocketship1.com>, Eric Taylor <et2@rocketship1.com> wrote: > > >Does anyone know where I can find a tcl proc >that would take an image, say a gif, and output >pure tcl code that I could paste into a program? > >I saw something about a unix program that did >something with mimes but I'm on windows. > > I think TkProE (http://tkproe.sourceforge.net) can do this. A quick look suggests that the procs TP_ImageToData & TP_ImageEncode might do what you want. Ted Eric Taylor wrote: > Does anyone know where I can find a tcl proc > that would take an image, say a gif, and output > pure tcl code that I could paste into a program? > > I saw something about a unix program that did > something with mimes but I'm on windows. > > Something like this ought to be pretty close (untested, but I think it's pretty close). It requires the base64 package from tcllib: package require base64 proc main {} { global argv set file [lindex $argv 0] set fd [open $file r] set rawdata [read $fd] close $fd set b64data [base64::encode $rawdata] puts "image create photo -data {\n$b64data\n}" } mai...

Read block of file in Tcl
Hi, I have an input file in the following format: ******************************** Name1 Name2 Row1 DEF 001 Row2 ABC DEG 003 Row3 EW EW 002 Row4 FF 0012 Row1 ADEF 1001 Row2 ARBC DEG 2003 Row3 EWW EW 0302 Row4 AB 0112 Name1 Name2 Row1 DSDEF 001 Row2 ABVC DEG 003 Row3 EDW EW 002 Row4 FVF 0012 Row1 AF 1001 Row2 ACRBC DEG 2003 Row3 ESWW EW 0302 Row4 AEB 0112 **************************************** I have to read this file and --> if I get "Name1" in any of the line, then I have to read the block of file from "Name1" to the first occurrance of "Row4". --> If I get "Row1" after the above reading is done, then I have to read the block of file from "Row1" to the first occurrance of "Row4". Can anyone help me out in doing this through TCL. Thanks and regards, Calvin calvin hobbes wrote: > > Hi, > > I have an input file in the following format: > ******************************** > Name1 > Name2 > Row1 DEF 001 > Row2 ABC DEG 003 > Row3 EW EW 002 > Row4 FF 0012 > Row1 ADEF 1001 > Row2 ARBC DEG 2003 > Row3 EWW EW 0302 > Row4 AB 0112 > Name1 > Name2 > Row1 DSDEF 001 > Row2 ABVC DEG 003 > Row3 EDW EW 002 > Row4 FVF 0012 > Row1 AF 1001 > Row2 ACRBC DEG 2003 > Row3 ESWW EW 0302 > Row4 AEB 0112 > **************************************** > I have to read this file and > --> if I get "Name1" in any of the line, > then ...

How to read a file using TCL
Hi, I am a new bee to TCL. I want to write a script that opens the file and reads it and prints to screen. I have tried the below. But doesn't works. set INFILE [open "temp" a+] set data [read $INFILE] set data [split $data "\n"] foreach line $data { puts $line } -Regards Swaroop Kumar Tata On 14 Mai, 10:39, Swaroop <swaroop.t...@gmail.com> wrote: > Hi, > I am a new bee to TCL. I want to write a script that opens the > file and reads it and prints to screen. I have tried the below. But > doesn't works. > > set INFILE [open "temp" a+] You're opening in "a" (append) mode, that is, the file pointer puts at the end. As you want to read the file, why not use mode "r", which is default anyway? So just do set INFILE [open temp] On May 14, 2:20 pm, suchenwi <richard.suchenwirth- bauersa...@siemens.com> wrote: > On 14 Mai, 10:39, Swaroop <swaroop.t...@gmail.com> wrote: > > > Hi, > > I am a new bee to TCL. I want to write a script that opens the > > file and reads it and prints to screen. I have tried the below. But > > doesn't works. > > > set INFILE [open "temp" a+] > > You're opening in "a" (append) mode, that is, the file pointer puts at > the end. As you want to read the file, why not use mode "r", which is > default anyway? So just do > set INFILE [o...

Dose there any tcl script to translate an file with embedded tcl
Hi I need to generate some big file, but there are rules for generate these files Ex . ============================== Start input a [0] wire input a [1] wire .. .. .. .. input a [1000] wire End ================================= Dose there any tcl script can help to translate a file with embedded tcl script into a new file For example this is a source file ======================== Start * set i 0 * for { set i 0 } { $i < 1000 } { incr i } { * puts input a [$i] wire * } End ========================== After Translate ======================= Start input a [0] wire input a [1] wire .. .. .. .. input a [1000] wire End ======================= Gogo12 wrote: > > Hi > I need to generate some big file, but there are rules for generate > these files > Ex . > ============================== > Start > input a [0] wire > input a [1] wire > . > . > . > . > input a [1000] wire > End > ================================= > > Dose there any tcl script can help to translate a file with embedded > tcl script into a new file > For example > > this is a source file > ======================== > Start > * set i 0 > * for { set i 0 } { $i < 1000 } { incr i } { > * puts input a [$i] wire > * } > End > ========================== > > After Translate > ======================= > Start > input a [0] wire > input a [1] wire > . > . > . > . > input a [1000] wire > ...

tcl-pam: PAM authentication for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-pam Tcl-pam is a Tcl interface to the PAM* service of Linux. It provides a Tcl package that allows Tcl scripts to use PAM to authenticate users and programs. It relies on linux-pam library: http://www.kernel.org/pub/linux/libs/pam/ * PAM (Pluggable Authentication Modules): A mechanism to integrate multiple low−level authentication schemes into a high−level application programming interface (API). This enables programs that rely on authentication to be written independently of the underlying authentication scheme. Platform: Linux Home page: http://sourceforge.net/projects/tcl-pam/ Man page: http://tcl-pam.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

Reading a tcl file in C
I have a tcl configure file (a list of variables with values and comments) that I wish to read into an array in C (or better yet, Objective-C). Does anyone have any suggestions of how to do this, or have any public-domain or GPL code that does this? randall.h.wood@gmail.com wrote: > I have a tcl configure file (a list of variables with values and > comments) that I wish to read into an array in C (or better yet, > Objective-C). Does anyone have any suggestions of how to do this, or > have any public-domain or GPL code that does this? Can you give us a short example of what this file will look like? -- +--------------------------------+---------------------------------------+ | Gerald W. Lester | |"The man who fights for his ideals is the man who is alive." - Cervantes| +------------------------------------------------------------------------+ On Mar 13, 9:02 am, "Gerald W. Lester" <Gerald.Les...@cox.net> wrote: > randall.h.w...@gmail.com wrote: > > I have a tcl configure file (a list of variables with values and > > comments) that I wish to read into an array in C (or better yet, > > Objective-C). Does anyone have any suggestions of how to do this, or > > have any public-domain or GPL code that does this? > > Can you give us a short example of what this file will look like? > I apologize for the delayed response. EXAMPLE FOLLOWS: # Set the dire...

tcl-mq: POSIX Message Queues for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mp Tcl-mp is a Tcl interface to POSIX Message Queues*. It provides a Tcl package that allows scripts to create/open/close/unlink multiple parallel message queues, and to send/receive messages synchronously and asynchronously to/from them. * A POSIX message queue is an Inter-Process Communication mechanism available on Linux and some other POSIX-compliant operating systems. It allows to or more processes (or threads) to communicate under the same OS. The messages are buffered by the kernel, which gives them kernel persistency. A message queue can be thought of as a linked list of messages. Threads with adequate permission can put messages onto the queue, and threads with adequuate permission can remove messages from the queue. Each message is assigned a priority by the sender, and the oldest message of highest priority is always retrieved first. Unlike PIPES and FIFOS, no requirement exists that someone be waiting for a message to arrive on a queue, before some process writes a message to that queue. It's not even a requirement for both processes to exist at the same time. Read mq_overview(7) for more details Platform: Linux Home page: http://sourceforge.net/projects/tcl-mp/ Man page: http://tcl-mp.sourceforge.net/ Author: Alexandros Stergiakis alsterg On Sep 3, 11:37=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl pro...

tcl-mmap: A POSIX mmap interface for Tcl. (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-mmap Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides a Tcl package that allows Tcl scripts to: 1) Memory map files for improved access efficiency; 2) Share memory between related processes; 3) Easily implement cyclic persistent log files. * See the mmap(2) man page. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-mmap/ Man page: http://tcl-mmap.sourceforge.net/ Author: Alexandros Stergiakis On Sep 3, 11:48=A0am, Alexandros Stergiakis <alst...@gmail.com> wrote: > This is an announcement for a relatively new Tcl project: tcl-mmap > > Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides > a Tcl package that allows Tcl scripts to: 1) Memory map files for > improved access efficiency; 2) Share memory between related processes; > 3) Easily implement cyclic persistent log files. > > * See the mmap(2) man page. > Great to see this and the other packages you made. Looking at the manpage it looks a bit misformatted before the usage example. Any specific reason to use GPL for this instead the usual Tcl/MIT/BSD style license used? Michael schlenk wrote: > On Sep 3, 11:48 am, Alexandros Stergiakis <alst...@gmail.com> wrote: >> This is an announcement for a relatively new Tcl project: tcl-mmap >> >> Tcl-mmap is a Tcl interface to the POSIX mmap* system call. It provides >> a Tcl package that...

tcl-syslog: Unix system logging for Tcl (Tcl package)
This is an announcement for a relatively new Tcl project: tcl-syslog Tcl-syslog is a Tcl interface to the *nix syslog service. It provides a Tcl package that allows Tcl scripts to log messages to syslog. Platform: Linux/Unix Home page: http://sourceforge.net/projects/tcl-syslog/ Man page: http://tcl-syslog.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

TCL file reading enhancement idea
Earlier today I read a post where someone was having a problem getting 'tail' to work for reading a file. I also have a need to just read the end of file but I am trying to stay from exec OS APIs in my application and just stay with pure TCL. After thinking about this it occurred to me that a useful addition to TCL would be an implementation of 'tail' that would return some configurable value of lines (for example, the last 5 lines) from the end of a file. I have tried reading the whole file just to check for some data at the end. This works fine for small files but for large files it really slows down performance, especially if multiple large files are being simultaneously read. Earl Grieda wrote: > Earlier today I read a post where someone was having a problem getting > 'tail' to work for reading a file. I also have a need to just read the end > of file but I am trying to stay from exec OS APIs in my application and just > stay with pure TCL. After thinking about this it occurred to me that a > useful addition to TCL would be an implementation of 'tail' that would > return some configurable value of lines (for example, the last 5 lines) from > the end of a file. > > I have tried reading the whole file just to check for some data at the end. > This works fine for small files but for large files it really slows down > performance, especially if multiple large files are being simultaneously > read. &...

TCL code to read a following file
How to read the following file using arrays in a tcl code. I should store all the begincase ids in one variable and beginlist ids in one variable and contents between the BeginList and EndList in one variable and I should pass all these arguments to a another file. BeginList is dependent on BeginCase.. Each beginCase contain so many beginLists. BeginCase:1 BeginList:1 Stress EndList BeginList:3 Stress|(Min)|VonMises EndList BeginList:8 Stress // Elements, ByID, 12, 14, 67 EndList BeginList:9 Stress EndList BeginList:12 Stress EndList EndCase BeginCase:2 BeginList:(All) Displacement // Nodes, ByID, 1,45,67,104-106 Strain Energy|Strain Energy Strain Energy|Energy Density EndList EndCase BeginCase:3 BeginList:1 Displacement EndList EndCase On May 19, 3:36 pm, nehal <sowmya.ne...@gmail.com> wrote: > How to read the following file using arrays in a tcl code. > (nested constructs) Hint :use regsub to replace all your "begin foobar"s by "foobar {", and all your "end"s by "}". Then use [eval]. -Alex In article <1179600905.738853.34140@u30g2000hsc.googlegroups.com>, Alexandre Ferrieux <alexandre.ferrieux@gmail.com> wrote: >On May 19, 3:36 pm, nehal <sowmya.ne...@gmail.com> wrote: >> How to read the following file using arrays in a tcl code. >> (nested constructs) &...

read excel file from tcl in li
Hi everyone i wonder if anybody know if there is anyway to read excel file from tcl in linux? as tcom work only in windows Thanks in advance. On Jan 22, 2:03=A0pm, "m.gad" <mohamedsami...@gmail.com> wrote: > Hi everyone > > i wonder if anybody know if there is anyway to read excel file from > tcl in linux? > > as tcom work only in windows > > Thanks in advance. There is a small command-line tool "xls2csv" (in the catdoc package IIRC) which will convert what can be to CSV. Of course you'll lose Excel-specific metainformation. (Beware, there is also a Perl script by the same name, but in my experience the C one is just fine with fewer dependencies ;-) -Alex m.gad wrote: > i wonder if anybody know if there is anyway to read excel file from > tcl in linux? > > as tcom work only in windows Newer Excel versions can write in an XML format. This should be fairly easy to read from Tcl. Just make sure you have the proper file format. (I haven't really been doing much parsing, but we write lots of Excel reports from Tcl by just writing some XML. Works great as you can have all Excel features: just create what you want in Excel, save it as XML, then open it with an editor to see how Excel actually writes it) hth Ronnie ...

windows tcl to read unix files
Hi, I need to write a tcl script for MS windows to read 2 text files in unix server. These 2 text files have the same file name but different case letter (i.e. A.txt and a.txt) and they are in the unix system. The tcl script needs to be executed under MS windows and then through the network to read these 2 files. Does any one know how to do that? I am having troubles because the tcl script under MS windows treats these 2 files as one file (it does not distinguish the case letter). And so it only opens A.txt whether it read "A.txt" or "a.txt". Please let me know if anyone knows how to solve the problem. Any comment is appreicated. Thanks in advance --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =- macray wrote: > > Hi, > > I need to write a tcl script for MS windows to read 2 text files in unix server. These 2 text files have the same file name but different case letter (i.e. A.txt and a.txt) and they are in the unix system. The tcl script needs to be executed under MS windows and then through the network to read these 2 files. > > Does any one know how to do that? I am having troubles because the tcl script under MS windows treats these 2 files as one file (it does not distinguish the case letter). And so it only opens A.txt whether it read "A.txt" or "a.txt". > > Please let m...

Tcl library for reading ELF files ?
Does anybody know wheather there is a Tcl library available for reading ELF files ? Thanks, Rolf. --------------------------------------------------------------- Rolf Schroedter, German Aerospace Center Remove .nospam to reply: mailto:Rolf.Schroedter@dlr.de.nospam ...

Reading files in tcl that are unicode encoded
Hi, I saved a txt file from notepad in UTF-8 format (or unicode format, as these are the 2 options I have in windows notepad). I started a Wish shell in windows and when I do a glob *.txt, the file name is show in unicode encoded characters (even the file name is saved as unicode format). I want to display this file in wish text box so that it appears same as that in Notepad. Can I do that in Wish. If not what else has to be done to show this file n text box. I assume that if this can be shown in text box, the same holds for entry. Thanks Kiran Kiran Madabhushi wrote: > Hi, > I saved a txt file from notepad in UTF-8 format (or unicode format, as > these are the 2 options I have in windows notepad). I started a Wish > shell in windows and when I do a glob *.txt, the file name is show in > unicode encoded characters (even the file name is saved as unicode > format). I want to display this file in wish text box so that it > appears same as that in Notepad. Can I do that in Wish. If not what > else has to be done to show this file n text box. I assume that if > this can be shown in text box, the same holds for entry. > This should work, could stumble over the byte order markers Notepad places in error (http://sourceforge.net/tracker/index.php?func=detail&aid=800114&group_id=10894&atid=110894 ) package require Tk set file [tk_getOpenFile] set fd [open $file] fconfigure $fd -encoding utf-8 set text [read $fd] close $fd text .t -width...

tcl-inotify: File & directory level notifications for Tcl. (extension)
This is an announcement for a relatively new Tcl project: tcl-inotify. Tcl-inotify is a Tcl interface to the linux kernel's inotify* service. It provides a Tcl package that enables Tcl scripts to monitor the file system changes at a file and directory level. A large number of file/directory actions can be monitored. A proc is executed asynchronously to notify for changes. * inotify is a Linux kernel subsystem that provides file system event notifications. It was written by John McCutchan with help from Robert Love and later Amy Griffis to replace dnotify. It was included in the mainline kernel starting from release 2.6.13, and could be compiled into 2.6.12 and possibly earlier releases by use of a patch. Its function is essentially an extension to filesystems to notice changes to the filesystem, and report those changes to applications. Home page: http://sourceforge.net/projects/tcl-inotify/ Man page: http://tcl-inotify.sourceforge.net/ Author: Alexandros Stergiakis alsterg ...

Tcl file from .txt file
Hi, I have a excel file. I need to change the excel file in to tcl file. I did = change the excel file in to txt file. but unable to change the txt file in = to tcl file. let me know any idea to change the txt file in to tcl file or = directly from the excel file in to tcl file.=20 your help is much more appreciated. thank you. On 11/14/14, 1:30 PM, yenilsuwal@gmail.com wrote: > Hi, > > I have a excel file. I need to change the excel file in to tcl file. I did change the excel file in to txt file. but unable to change the txt file in to tcl file. let me know any idea to c...

Komodo: Accessing widgets in the auto generated _ui.tcl from the associated .tcl file
I am using Komodo. I created a text widget and want to insert some text into it. The below is my ui.tcl file (ie. Dialog_ui.tcl). In my Dialog.tcl file I want to have access to the $base._text_log widget, so I can insert text into it. For eg. I've tried: ::Dialog::._text_log insert end "hello world!" And other variations, but have not succeeded. This seems to be something trivial, but I can't seem to figure it out. I also tried to get to the BASE variable, but was also unsuccessful. I guess my understanding of namespaces isn't correct. Is it even possible? Help is very very much appreciated. Thank you! # Below is the gui code in Dialog_ui.tcl # Declare the namespace for this dialog namespace eval Dialog {} package require Tk # Dialog::ui -- # # Create the UI for this dialog. # # ARGS: # root the parent window for this form # args a catch-all for other args, but none are expected # proc Dialog::ui {root args} { # this handles '.' as a special case set base [expr {($root == ".") ? "" : $root}] variable ROOT $root variable BASE $base # Widget Initialization text $base._text_log \ -height 0 \ -width 0 \ -xscrollcommand [namespace code [list _text_log_xscrollcommand]] \ -yscrollcommand [namespace code [list _text_log_yscrollcommand]] # Geometry Management grid $base._text_log -in $root -row 1 -column 1 \ -columnspan 1 \ -ipadx 0 \ -ip...

Web resources about - read an XML file in TCL - comp.lang.tcl

Read-Only Memory
Read-Only Memory publishes high-quality books and articles that document defining moments in videogame history.

Leonard Read - Wikipedia, the free encyclopedia
( 1898-09-26 ) September 26, 1898 Hubbardston , Michigan , U.S. Leonard E. Read (September 26, 1898 – May 14, 1983) was an American economist ...

First Read
The first place for news and analysis from the NBC News Political Unit. Follow us on Twitter.

First Read
The first place for news and analysis from the NBC News Political Unit. Follow us on Twitter.

WhatsApp Lets Users Know When Messages Are Read
Users of Facebook-owned cross-platform messaging application WhatsApp can now tell when their messages have been read. (more…) New Career Opportunities ...

Significant Read: “She Wanted to Do Her Research. He Wanted to Talk ‘Feelings.’”
... of the sharpest tools in the shed. My own experiences as a student, scientist and mentor lead me to believe that such harassment is widespread. ...

Watch Mitt Romney read mean tweets from Donald Trump on Jimmy Kimmel Live
... Kimmel realized that the fallout of Romney's remarks would make perfect fodder for his ever-dependable Mean Tweets segment. Continue reading... ...

The Donald Trump we don't get to see: The Donald Trump "that sits, and reads and thinks."
... are two Donald Trumps. I think there's one Donald Trump. But certainly you have all of this, and you have somebody else that sits, and reads ...

Ritholtz's Reads: Where That Money Went
Here are your Friday reads.

Murray: Careful to read everything that is relevant to him
INDIAN WELLS, Calif. (AP) — Scottish tennis star Andy Murray reacted to Maria Sharapova's failed drug test by noting that he's careful to read ...

Resources last updated: 3/13/2016 4:35:40 PM