Re: [tDOM] Writing parsed xml document back to a file
- From: Helmut Giese <hgiese@xxxxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 09:19:30 +0200
On Tue, 29 Jul 2008 16:44:50 +0200, Daniel Kirsch
<Iwillnotread_daniel@xxxxxx> wrote:
I want to write a parsed XML document back to a file.
I have:
set courseFile [tDOM::xmlOpenFile $fileName];
dom parse -channel $courseFile courseDoc;
When using
$courseDoc asXML
all header information including the encoding definition are missing.
Is there something similar to tDOM::xmlOpenFile for saving a file?
And is there some documentation about tDOM::xmlOpenFile?
Hi Daniel,
not that I know of. What I do is to pass the wanted header along with
the tree to a little helper proc.
---
#
# tree2XML Write a DOM tree as XML file $fName
# (optionally preceded by $leadIn)
#
proc tree2XML {tree fName {leadIn ""}} {
set f [open $fName w]
set xml $leadIn
append xml [$tree asXML]
puts $f $xml
close $f
}
---
HTH
Helmut Giese
.
- Follow-Ups:
- Re: [tDOM] Writing parsed xml document back to a file
- From: Daniel Kirsch
- Re: [tDOM] Writing parsed xml document back to a file
- References:
- [tDOM] Writing parsed xml document back to a file
- From: Daniel Kirsch
- [tDOM] Writing parsed xml document back to a file
- Prev by Date: Re: Possible revival of comp.lang.tcl.announce
- Next by Date: Re: [tDOM] Writing parsed xml document back to a file
- Previous by thread: [tDOM] Writing parsed xml document back to a file
- Next by thread: Re: [tDOM] Writing parsed xml document back to a file
- Index(es):
Relevant Pages
|