ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> Tclxml-users
Tclxml-users
[Tclxml-users] itcl/tk-like calling syntax for TclDom
by Detlef Groth other posts by this author
Sep 14 2004 2:37PM messages near this date
[Tclxml-users] Tclxml 3.0 problems | Re: [Tclxml-users] itcl/tk-like calling syntax for TclDom
Hello,

I like the itcl/tk- and Tdom-like calling conventions for tdom:

(tclkit) 82 % set doc [dom::DOMImplementation create]
::dom::tcl::document7::Document
(tclkit) 83 % set top [dom::document createElement $doc html]
::dom::tcl::document7::node2
(tclkit) 84 % set title [$doc createElement title]
::dom::tcl::document7::node6
(tclkit) 85 % $top appendChild $title
::dom::tcl::document7::node6
(tclkit) 86 % set body [$doc createElement body]
::dom::tcl::document7::node13
(tclkit) 87 % $top appendChild $body
::dom::tcl::document7::node13
(tclkit) 88 % $body setAttribute bgcolor black
unknown method "setAttribute"

This does not work, however this:

(tclkit) 90 % dom::element setAttribute $body bgcolor black
black

which is for me a little bit awkward, and I always forget to add the
nodename after the (get|set)Attribute-command. I am used to javascript
where we say something like:

var input = window.document.createElement("input");
input.setAttribute("name", "inputvalue");

(tclkit) 91 % ::dom::serialize $doc
<?xml version='1.0'?> 
<!DOCTYPE html> 
<html> <title/><body bgcolor="black"/></html>

It should be not to difficult to write some simple wrapper classes
with Snit or something similar. As a side effect the same code might
run with tdom also. But using snit may slow down the code. Did
anyone have a better suggestion?

regards,
Detlef

-- 
Dr. Detlef Groth
Max-Planck-Institut
fuer Molekulare Genetik
Ihnestr. 63/73
D-14195 Berlin
Tel.: + 49 30 - 8413 1235


-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
Tclxml-users mailing list
Tclxml-users@[...].net
https://lists.sourceforge.net/lists/listinfo/tclxml-users
Thread:
Detlef Groth
Steve Ball

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved