Grupos de Google ya no admite nuevas publicaciones ni suscripciones de Usenet. El contenido anterior sigue siendo visible.

Any one use xml in a tcl\tk application to create new UI?

Visto 51 veces
Saltar al primer mensaje no leído

pheobe

no leída,
21 ago 2007, 20:33:3021/8/07
a
What I want is:
In an application written in tcl\tk, I want to source or excute severl
different xml files, so that I can create different window from these
xml files. And infomation needs to be passed from tk application and
will be passed back to it from the new created window. That is, new
created window will be integrated into tk application just like it's a
top window written in tk.

Gerald W. Lester

no leída,
21 ago 2007, 21:47:2121/8/07
a

It would be straight forward to do -- but why?

Do you have some XML "UI" description from somewhere that you need to implement?

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+

pheobe

no leída,
21 ago 2007, 22:17:0821/8/07
a

Yes, I need to these xml files to generate dirrefent tables to
interact with tk applications. Or Is there any way out to do so?

Gerald W. Lester

no leída,
21 ago 2007, 22:49:4221/8/07
a

Parse the XML with either tdom or tcldom. Walk the tree and generate the Tk
widgets being called for.

If you could point us to descriptions of this XML we may be able to give
better advise.

pheobe

no leída,
21 ago 2007, 23:27:4821/8/07
a

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>dujuan</Author>
<LastAuthor>author_name</LastAuthor>
<Created>2007-08-22T01:02:53Z</Created>
<Company>xxx</Company>
<Version>11.5606</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>12105</WindowHeight>
<WindowWidth>15225</WindowWidth>
<WindowTopX>480</WindowTopX>
<WindowTopY>45</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="2"
x:FullColumns="1"
x:FullRows="1">
<Row>
<Cell><Data ss:Type="String">DR</Data></Cell>
<Cell><Data ss:Type="String">DL</Data></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">DR2</Data></Cell>
<Cell><Data ss:Type="String">DL2</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>1</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet3">
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>

For example, the above xml file only include a simple table. It has
two coloumns and two rows. I know how to use tdom to parse xml to
output some text, but I don't know how to use it to "Display" table in
another top windows.

pheobe

no leída,
21 ago 2007, 23:30:1121/8/07
a
The above xml file is a simple speadsheet saved from MS excel.

pheobe

no leída,
21 ago 2007, 23:36:0321/8/07
a

package require tdom


set xml_file "$env(UH)\\Book1.xml"
set xml [tDOM::xmlReadFile $xml_file]

puts "tdom::: [time {dom parse $xml} 10]"

Actually I use the above lines to parse a xml file(saved from MS
excel), and it did puts the content in the command console along with
my application. But what I want is to display UI described in the xml
file, not just puts something in the command console.

MartinLemburg@UGS

no leída,
22 ago 2007, 8:09:1822/8/07
a
Hi Pheobe,

I found your "problem" so interessting, that I invested some time.

The results you can find at:

http://wiki.tcl.tk/19814

There is a sample using the tdom, BWidget and tablelist package to
create tables from the sample XML file you provided here in this
thread.

Much fun!

Best regards,

Martin Lemburg

0 mensajes nuevos