From: Derek F. <fo...@hu...> - 2002-09-06 10:14:17
|
> ::dom::DOMImplementation createDocumentType $doc "test" {} "test.dtd" > ::dom::document createElement $doc "test" > > puts [::dom::DOMImplementation serialize $doc] > > which gives an error: > > "wrong number of arguments, should be: DOMImplementation createDocumentType > name publicid systemid" > > Looking at the code in tclxml-2.0 and 2.2, I'm a bit suspicous that > something's not right. Do the parameters for the call to CreateDocType from > inside dom::tcl::DOMImplementation match up with what the routine's > expecting to receive? I'm a bit out of my depth with that sort of Tcl code, > so apologies if I'm casting aspersions. > > Can someone fix my code above so I can see exactly what I've got wrong? Replying to myself, which is always good form, I patched domimpl.tcl in the 2.2 code like this: --- >diff -u domimpl.tcl.orig domimpl.tcl --- domimpl.tcl.orig Fri Sep 6 10:10:48 2002 +++ domimpl.tcl Fri Sep 6 11:06:52 2002 @@ -215,11 +215,11 @@ createDocumentType { # Introduced in DOM Level 2 - if {[llength $args] != 3} { - return -code error "wrong number of arguments, should be: DOMImplementation createDocumentType name publicid systemid" + if {[llength $args] != 4} { + return -code error "wrong number of arguments, should be: DOMImplementation createDocumentType token name publicid systemid" } - return [CreateDocType [lindex $args 0] [list [lindex $args 1] [lindex $args 2]]] + return [CreateDocType [lindex $args 0] [lindex $args 1] [lindex $args 2] [lindex $args 3]] } createNode { --- and changed my script to contain: ::dom::DOMImplementation createDocumentType $doc "test" [list "" "test.dtd"] {} This gives: <?xml version='1.0'?> <!DOCTYPE test SYSTEM "test.dtd"> <test/> which is what I expect. Am I getting anywhere with this, or am I just making myself look like an idiot in public? :-} -- The past: Smart users in front of dumb terminals |