473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

modify XML document

I have a document XML that I would modify in VisualBasic.NE
When the user set the checkbox and radiobutton in a form I save this information and modify a document
My document is in the following form

<opzioni><opzione nome="DDR"><item tipo="prova" label="Ridotto">true</item><item tipo="completo" label="ok">false</item></opzione><opzione nome="SDR"><item tipo="speed" label="Veloce">true</item><item tipo="normal" label="Normale">false</item></opzione></opzioni

I have to modify the value True/False into the TAG <item

xmlDoc.Load(fileName
root = xmlDoc.DocumentElemen
nodeList = root.SelectNodes("opzione/item"
For I = 0 To nodeList.Count -
elem = nodeList.Item(I
elem.Value = NEWVALUE ****My code generate an error here***

This is the error messagge:
"Impossibile impostare un valore su un nodo di tipo: Element.

thank yo
cos75
Jul 21 '05 #1
10 2576
Change the line wich generated the error into

elem.InnerXml = NEWVALU

Marinus
Jul 21 '05 #2
Use node.InnerText instead of node.Valu

By the way, I had to get BabelFish to hep me with your error message.
Jul 21 '05 #3
hmm.. Two different answers, that's nice

If we have the following XML-cod

<opzione nome="SDR"><item tipo="speed" label="Veloce">test1<child>ab</child>test2</item></opzione

InnerText would return
test1abtest

InnerXml would return
test1<child>ab</child>test

Setting XML with InnerText or InnerXml makes no difference as long as there are no XML-tags (<child></child>
InnerText will screw these tags (&lt,&gt)

In the given case there's no difference.
Jul 21 '05 #4
ok but now I have lost every attribute on the tag ite
----- Marinus Holkema wrote: ----

Change the line wich generated the error into

elem.InnerXml = NEWVALU

Marinus
Jul 21 '05 #5
I changed the line in elem.value=false.ToString()

other assumptions
root as XmlElemen
nodelist as XmlNodeLis
xlmDoc as XmlDocumen
elem as XMLNod

the resulting xml was

<opzioni><opzione nome="DDR"><item tipo="prova" label="Ridotto">False</item><item tipo="completo" label="ok">False</item></opzione><opzione nome="SDR"><item tipo="speed" label="Veloce">False</item><item tipo="normal" label="Normale">False</item></opzione></opzioni

Any differences?
Jul 21 '05 #6
Change the line wich generated the error into

elem.InnerXml = NEWVALU

Marinus
Nov 22 '05 #7
Use node.InnerText instead of node.Valu

By the way, I had to get BabelFish to hep me with your error message.
Nov 22 '05 #8
hmm.. Two different answers, that's nice

If we have the following XML-cod

<opzione nome="SDR"><item tipo="speed" label="Veloce">test1<child>ab</child>test2</item></opzione

InnerText would return
test1abtest

InnerXml would return
test1<child>ab</child>test

Setting XML with InnerText or InnerXml makes no difference as long as there are no XML-tags (<child></child>
InnerText will screw these tags (&lt,&gt)

In the given case there's no difference.
Nov 22 '05 #9
ok but now I have lost every attribute on the tag ite
----- Marinus Holkema wrote: ----

Change the line wich generated the error into

elem.InnerXml = NEWVALU

Marinus
Nov 22 '05 #10
I changed the line in elem.value=false.ToString()

other assumptions
root as XmlElemen
nodelist as XmlNodeLis
xlmDoc as XmlDocumen
elem as XMLNod

the resulting xml was

<opzioni><opzione nome="DDR"><item tipo="prova" label="Ridotto">False</item><item tipo="completo" label="ok">False</item></opzione><opzione nome="SDR"><item tipo="speed" label="Veloce">False</item><item tipo="normal" label="Normale">False</item></opzione></opzioni

Any differences?
Nov 22 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: titanandrews | last post by:
Hi, I have ran into a situation that I think should be possible, but I am fairly new to XSLT so maybe not. Suppose I have the following document <ROOT> <FOO name="A"> <CHILD name="B"/>...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
1
by: qasimraza1979 | last post by:
HI, I am currently analysing the scenario to modify word document if MS word in not installed on the server. Actually I was thinking to modify my word document using...
15
by: Inny | last post by:
Hello, I found this simple js star rating script that I want to modify slightly. firstly I want to retain current vote , say 3 stars, untill its changed again. right now it resets to unvoted...
5
by: kidders | last post by:
Below is a script i need to modify to work and its driving me nuts. Essentially it fades the content of an array. The original script specified the object name, I tried to modify it to allow an...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.