PDA

View Full Version : getting a node value


angiras
10-05-2003, 09:34 AM
what is the correct string to get a node value


for

<sampleSection setting1="Value1" setting2="value two" setting3="third value" />

I get an error with :

Dim _node As String = "sampleSection[@setting1]"

how ca i get Value1 ?

thank you

jkd
10-05-2003, 04:44 PM
Dim _node As String = "sampleSection/@setting1"

I think? It's been a while.

angiras
10-05-2003, 05:10 PM
super

thank you

M@rco
10-11-2003, 12:34 PM
<sampleSection setting1="Value1" setting2="value two" setting3="third value">example</sampleSection>angiras, just so you know, "Value1" is an attribute value, whereas "example" is the node value.

;)

liorean
10-12-2003, 09:28 PM
Actually, the node value of an attribute node is the attribute value, what you pointed to was the node value of an entirely different node, the text node child of the element node. See: <http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247>

angiras
10-13-2003, 07:19 AM
thank you for the link

Alex Vincent
10-14-2003, 06:04 AM
Originally posted by liorean
Actually, the node value of an attribute node is the attribute value, what you pointed to was the node value of an entirely different node, the element node. See: <http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247>

IIRC, the "example" word should actually be a Text node.

liorean
10-14-2003, 08:09 AM
Yeah, you're right. It's the nodeValue of the text node and nothing else...

M@rco
10-14-2003, 11:09 AM
You're all quite right... I was getting semantic, but I hadn't been precise enough myself! lol :p

Alex Vincent
10-15-2003, 02:47 AM
Heh, it actually matters a great deal. Text nodes have only one method and no properties beyond the Node interface. But Element nodes have a whole bunch of stuff. So the node type is important.

XML languages are very unforgiving of sloppy code; the focus is on doing things rigourously. So we're a bit careful with how we define terms.

M@rco
10-15-2003, 02:58 AM
No argument from me there. ;)