始化 Private Sub Class_Initialize() On Error Resume Next MessageCode = "" XmlPath = "" Set XmlDoc = Server.CreateObject("msxml2.FreeThreadedDOMDocument.3.0") XmlDoc.ASYNC = False End Sub Rem 销毁对象 Private Sub Class_Terminate() If IsObject(XmlDoc) Then Set XmlDoc = Nothing If IsObject(m_XmlDocAccept) Then Set m_XmlDocAccept = Nothing If IsObject(m_GetXmlDoc) Then Set m_GetXmlDoc = Nothing End Sub
''公共属性定义开始-------------------------- Rem 错误信息 Public Property Get Message() Message = MessageCode End Property
Rem 发送xml的地址 Public Property Let URL(str) m_url = str End Property ''公共属性定义结束-------------------------- ''私有过程、方法开始-------------------------- Rem 加载xml Private Sub LoadXmlData() If XmlPath <> "" Then If Not XmlDoc.Load(XmlPath) Then XmlDoc.LoadXml "<?xml version=""1.0"" encoding=""gb2312""?><root/>" End If Else XmlDoc.LoadXml "<?xml version=""1.0"" encoding=""gb2312""?><root/>" End If End Sub Rem 字符转化 Private Function AnsiToUnicode(ByVal str) Dim i, j, c, i1, i2, u, fs, f, p AnsiToUnicode = "" p = "" For i = 1 To Len(str) c = Mid(str, i, 1) j = AscW(c) If j < 0 Then j = j + 65536 End If If j >= 0 And j <= 128 Then If p = "c" Then AnsiToUnicode = " " & AnsiToUnicode p = "e" End If AnsiToUnicode = AnsiToUnicode & c |