For Programmers: Free Programming Magazines  


Home > Archive > Tcl > November 2006 > Re: multiple siblings, using tDOM to generate XML ... and eventually









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: multiple siblings, using tDOM to generate XML ... and eventually
Christian Nassau

2006-11-29, 7:08 pm

You should probably leave out the extra quotes from your definition of
the testscript, because those gives you the unwanted extra level of
grouping. If you use just

set teststring {
channel {
title { }
description { }
}
}

a plain

$root appendFromScript $teststring

ought to work.

jkj wrote:
> ...the entire test copied from my terminal:
> % package require tdom
> 0.8.0
> % set doc [dom createDocument test]
> domDoc0x8ebc648
> % set root [$doc documentElement]
> domNode0x8ebc8bc
> % dom createNodeCmd elementNode channel
> ::channel
> % dom createNodeCmd elementNode title
> ::title
> % dom createNodeCmd elementNode description
> ::description
> % set teststring "{
> channel {
> title { }
> description { }
> }
> }
> "
> {
> channel {
> title { }
> description { }
> }
> }
>
> % eval [concat "$root appendFromScript" $teststring]
> domNode0x8ebc8bc
> % puts [$root asXML]
> <test>
> <channel>
> <title/>
> <description/>
> </channel>
> </test>
>


--
=> Christian Nassau, http://www.nullhomotopie.de


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com