我已将 josn 对象转换为 xmlDocumet n 想将此 xmlDocumet 保存在计算机上,如使用 vb 的 abc.xml 请帮助。文件太大我无法读取其各个标签 n 请帮助
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 xmlDoc
End Function