VB.net replace text using XPathDocument

dadaf

New Member
I am in a situation where I need to replace a bit of text fetched from an xml file. The application currently uses an XPathDocument to read and XML file and instantiates a XPathNavigator object from the XPathDocument that gets passed to another method.All I need to do is replace a bit of text with something else before the XPathNavigator gets passed to the method.Say the XML looks like this:\[code\]<?xml version="1.0" encoding="utf-8" ?><node> <sub>I want to keep this but change this next bit {0}</sub></node>\[/code\]And the code that uses it is this:\[code\] Dim doc As XPathDocument = New XPathDocument(New System.IO.StreamReader(pathtoxml)) Dim nav As XPathNavigator = doc.CreateNavigator() 'I need to change the text before the next line executes somemethod(nav)\[/code\]If I could just do a simple String.format on the text that would be great, but I'm not sure if I can. MSDN is down right now for some reason so I don't have access to the API, which is another hindrance. Could anyone suggest the best way to accomplish what I am trying to do? Any help would be appreciated. Thanks much.
 
Back
Top