CS程序中XML编码Encode和解码Decode
VB6的代码,原则上只要是Windows系统均可以使用此方法
Function XMLEncode(ByVal text As String) As String Dim xmldoc Set xmldoc = CreateObject("Microsoft.XMLDOM") Dim e As IXMLDOMElement Set e = xmldoc.createElement("a") e.text = text XMLEncode = Mid(e.xml, 4, Len(e.xml) - 7) End Function Function XMLDecode(ByVal xml As String) As String Dim xmldoc Set xmldoc = CreateObject("Microsoft.XMLDOM") xmldoc.loadXML "<a>" & xml & "</a>" Dim e As IXMLDOMElement Set e = xmldoc.selectSingleNode("a") XMLDecode = e.text End Function
'需引用程序集 Microsoft.XML
桂棹兮兰桨,击空明兮溯流光。