Good evening Oleg
I've tried to do that, but i got one Error
<---Error
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.xml.dll
Additional information: Cannot set a value on node type: Element.
--->End Error
I've selected the first Element with Xpath
loDoc is a XMLDocument
loDoc.SelectSingleNode("/LicenceControlFile/MachineName").Value =
sMachineName
Whats wrong ?
Regards from Switzerland
Peter
"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:eD8UFN6dDHA.568@TK2MSFTNGP11.phx.gbl...[color=blue]
> Peter Treier wrote:
>[color=green]
> > <?xml version="1.0" encoding="utf-16"?>
> > <LicenceControlFile>
> > <Licence1>2AB7-FA43-B05C-4C2A-8DBD</Licence1>
> > <MachineName />
> > <Licence2>2AB7-FA43-B05C-4C2A-8DBD</Licence2>
> > <MachineName />
> > <Licence3>2AB7-FA43-B05C-4C2A-8DBD</Licence3>
> > <MachineName />
> > </LicenceControlFile>
> >
> > Now i need to set the Value of one of the <MachineName /> Elements !
> > How can i do this with .NET...[/color]
>
> The simplest (but not necessarily the most effective) way is to load[/color]
document[color=blue]
> to XmlDocument, select appropriate MachineName element using[/color]
SelectSingleNode[color=blue]
> method, update it and save document back.
> --
> Oleg Tkachenko
>
http://www.tkachenko.com/blog
> Multiconn Technologies, Israel
>[/color]