|
From: Derek F. <fo...@hu...> - 2002-07-09 08:55:10
|
On Tuesday 09 July 2002 1:26 am, you wrote:
> Did Steve's clt-posted answer take care of you?
Not really, no. :(
Steve said the way to get a Doc Type is:
::dom::DOMImplementation createDocumentType token name publicid systemid
If you don't want the public id, make it empty, eg:
::dom::DOMImplementation createDocumentType $doc product {} my.dtd
Which I'd largely worked out from the source. With ActiveTcl-8.3.4.3 that
gives me:
wrong number of arguments, should be: DOMImplementation createDocumentType
name publicid systemid
while executing
"::dom::DOMImplementation createDocumentType $doc "product" "" "testplan.dtd""
which, according to the code, is a valid error message. Steve's example gives
4 parameters, but the code only accepts 3. Internal usage of the
CreateDocType routine in dom.tcl suggests 4 parameters is correct. I wouldn't
claim to be good enough at Tcl to point and say "there's a bug in the
interface code for ::dom::DOMImplementation createDocumentType", but
something's not right.
The issue of processing instructions also remains. Steve confirms the way to
create one is
::dom::document createProcessingInstruction $parent target data
which is what I'm using. The thing is, the processing instruction is only
serialised if it's attached to an element node (which I found out by chance).
Attaching it to a document node, which in my admittedly limited XML
experience seems the natural thing to do, results in no processing
instruction from the serialisation. Perhaps the PI handling code is missing
in the serialisation code? Or perhaps this is by design and I don't
understand the design. :-}
And finally, the issue of colons in element names. Steve doesn't offer any
advice here, so my "regsub -all" stays in place at the end of my script to
get rid of them all.
So, in short, no, I'm still struggling with TclDOM. In the short term I've
hacked in some workarounds for the above issues which mean my script produces
the XML I need. That's got the boss off my back. I'm hoping that when Steve
gets back from his conference he'll be able to give me some more specific
advice.
--
9:12am up 57 days, 1:17, 2 users, load average: 0.03, 0.03, 0.05
|