1
<IS_ID>
<PROPERTIES SOURCE="Correction" USER="[email protected]" DATE="14-Sep-2012 15:47:27" />
<HEADER Action='Update' />
<HEADER EMO_ID="12503652" />
<HEADER SourceResolutionID="JT-362" />
<DETAIL Type=Cumulative/Service Pack/Patch Release />
<DETAIL Language=English />
<DETAIL ServicePack="11" />
<DETAIL ExternalDefectID=FIN-17243 />
<DETAIL ResolutionID=JT_1239 />
<DETAIL Classification=M3 Applications />
</IS_ID>
我可以使用下面的代碼屬性轉換爲String
,但同樣沒有爲HEADER
和DETAIL
元素的工作,因爲他們已經關閉標籤爲每個屬性。我該如何解決這個問題?XML至字符串轉換在.NET
Dim sbProperties As New System.Text.StringBuilder
sbProperties.Append("<PROPERTIES>")
If Not xmlAttributes Is Nothing Then
For Each xmlAttribute In xmlAttributes
sbProperties.Append("<" & xmlAttribute.Name.ToUpper & ">" & xmlAttribute.Value & "</" & xmlAttribute.Name.ToUpper & ">")
Next
sbProperties.Append("</PROPERTIES>")
Dim strProperties As String = sbProperties.ToString
End If
使用XMLReader類 – 0x4f3759df
這不是有效的XML下手...(如果你想* *構建XML,你絕對不應該在字符串操作中使用 - 使用XML API)。 –
我正在循環節點併爲每個元素創建String。我想將每個創建的元素的字符串傳遞給數據庫並更新表。 – user1681514