project details. I want to read some node value from this file and then update one value of another node. Can anybody help me to do this...?
XML file looks like this:
[HTML]
<AFPDetails>
<Printer>
<AFPPrinter>IBM AFP 240</AFPPrinter> 'want to read this IBM AFP240 value
</Printer>
<FileName>
<NextNumber>0</NextNumber> want to update 0 to 1,2...
</FileName>
</AFPDetails>
[/HTML]
I am using a code like this :
Expand|Select|Wrap|Line Numbers
- Dim xmlDocumnetObject As XmlDataDocument = New XmlDataDocument
- Dim xmlNodeObject As XmlNode
- xmlDocumnetObject.Load("AFPDetails.xml")
- ' to read value . This work fine
- xmlNodeObject = xmlDocumnetObject.SelectSingleNode("//Printer/AFPPrinter")
- If Not xmlNodeObject Is Nothing Then
- AFPDriver = xmlNodeObject.InnerText
- End If
- 'write value .This has not updated in the xml file but no exception thrown
- xmlNodeObject = xmlDocumnetObject.SelectSingleNode("//FileName/NextNumber")
- If xmlNodeObject IsNot Nothing Then
- xmlNodeObject.InnerText = (fileNextNumber + 1).ToString
- xmlDocumnetObject.Save("AFPDetails.xml")
- End If
jaleel