how to save xml in a file using vb

stadderzidiv

New Member
i have converted the josn object in to xmlDocumet n wanna to save this xmlDocumet on computer like abc.xml using vb please help.the file is so big i cant read its individual tags n kindly help\[code\]Private Function JsonToX() As XDocument Dim xmlDoc As XDocument Dim EventId As String EventId = GetEventID() Dim httpWebRequest As HttpWebRequest = WebRequest.Create(url) httpWebRequest.Method = WebRequestMethods.Http.Get httpWebRequest.Accept = "application/json" Dim response As HttpWebResponse response = httpWebRequest.GetResponse() Dim ResponseStream As Stream = response.GetResponseStream() Dim StreamReader As New StreamReader(ResponseStream) Dim Text As String = StreamReader.ReadToEnd() 'because the origional JSON string has multiple root's this needs to be added Dim jsonhtml As String = "{BFBC2_GlobalStats:" jsonhtml += Text + "}" xmlDoc = JsonConvert.DeserializeXNode(jsonhtml) ' want to save xmldoc in a file xmlDoc.Save("abc.xml") not working Return xmlDocEnd Function\[/code\]
 
Back
Top