tDOM nextSibling not working as expected.
by chedderslam » Thu, 05 Jun 2008 23:35:47 GMT
Here is the document I am parsing:
<recordset>
<division attribute1="attribute1 value" attribute2="attribute2
value">
<coe_division_name>MISSISSIPPI VALLEY</coe_division_name>
<division_abbreviation>MVD</division_abbreviation>
</division>
<division attribute1="attribute3 value" attribute2="attribute4
value">
<coe_division_name>DIFFERENT PLACE</coe_division_name>
<division_abbreviation>DP</division_abbreviation>
</division>
</recordset>
my proc runs through a recursive loop climbing down the DOM object.
When I get to the text node with the value "MISSISSIPPI VALLEY", the
value of nextSibling is blank, when it seems to me that it should not
be. I would think it would point to the text node with the value
"MVD".
I am trying to convert the xml document to a csv file, and need to
know if there is an element after the current one, and if there is, to
add a comma to the output. I'm just not sure how to get there.
Thanks,
Matthew
Re: tDOM nextSibling not working as expected.
by Darren New » Thu, 05 Jun 2008 23:57:19 GMT
The sibling of coe_division is division_abbreviation.
MISSISSIPPI VALLEY has no sibling, nor does MVD.
Why not loop over all children of <division> each time you get a
<division>, and then extract the elements you know must be there? If
you're building a csv file, you have to put the same stuff on each line.
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Re: tDOM nextSibling not working as expected.
by chedderslam » Fri, 06 Jun 2008 01:07:12 GMT
Thank you, I got it sorted. I went up to the parent node and checked
to see if it had a sibling.
Thanks for the help.
Similar Threads:
1.tdom - not understanding "nextSibling"
I have a simple xml document:
<recordset>
<division name="myname">
<coe_division_name>MISSISSIPPI VALLEY</coe_division_name>
<division_abbreviation>MVD</division_abbreviation>
</division>
</recordset>
Whe I am parsing it and get to the node:
<coe_division_name>MISSISSIPPI VALLEY</coe_division_name>
I am running this code:
set myvar [$doc nextSibling]
however, the result is blank.
What would constitute a sibling? How can I check if there is another
element on the same level of nesting right after the current element?
Thank you.
2.NASM does not have = and its %define does not work as I expected
NASM version 0.98.38 compiled on Sep 12 2003
I only want to make a linked strings like this, but it doesn't work as
I expeced
%define _link 0
xTable db 'abc',0
dw _link
%define _link $
db 'd',0
dw _link
%define _link $
db 'efghijk',0
lnkhead dw _link
1 %define _link 0
2
3 00000000 61626300 xTable db 'abc',0
4 00000004 0000 dw _link <=====
correct
5 %define _link $ <=== _link
is now = 6
6 00000006 6400 db 'd',0
7 00000008 [0800] dw _link <====
this should be 0006h but it's not !!
8 %define _link $ <=== _link
is now = A
9 0000000A 65666768696A6B00 db 'efghijk',0
10 00000012 [1200] lnkhead dw _link <===
this should be 000Ah but it's not !!
1
3.Range checking not working as expected?
4.trace does not work has expected
5.Expect not being able to work with a '$' within a variable
I have written an expect script which allows me to ssh to multiple
systems. The expect script is invoked through a bash script which
loops though all the systems. The problem that I'm running into is
that the password of my systems have '$' within, so when I pass the
password to expect:
ssh.exp system1 my$password myremotecommand
It returns with password incorrect.
I've tried escpaing the password by doing: my\$password and my\\\
$password - but when expect runs it:
set PASSWD [lrange 1 1]
spawn ssh -p port user@system1
expect "password: "{
sleep 1;
send $PASSWD
}
Is it possible to escape the $ contained within the variable?
6. Expect not working with SSH on CygWin
7. expect command does not work on windows XP
8. List parsing not working as expected