comp.lang.tcl
[Top] [All Lists]

Re: tdom - not understanding "nextSibling"

Subject: Re: tdom - not understanding "nextSibling"
From: Christian Nassau
Date: Thu, 29 May 2008 23:44:57 +0200
Newsgroups: comp.lang.tcl


chedderslam wrote:
    if { $type == "ELEMENT_NODE" } {
        append returnstring $name:
    } else {
        append returnstring $value
        # here's where I am having trouble
        if { [$doc nextSibling] != "" } {
            append returnstring ","
        }
    }

I think the problem might be that you're checking the wrong node for the existence of siblings. In the example

<recordset>
 <division name="myname">
  <coe_division_name>MISSISSIPPI VALLEY</coe_division_name>
  <division_abbreviation>MVD</division_abbreviation>
 </division>
</recordset>

it's "coe_division_name" (an ELEMENT_NODE) which has a sibling, not "MISSISSIPPI VALLEY" (which probably is what you're actually testing). It seems to me the test [$doc nextSibling] != "" (which is perfectly ok) should be contained in the "then" clause, not the "else" clause.

HTH,

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



<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy