实例演练ASP+XML编程比较全的了第1/2页(4)


   On Error Resume Next ' 捕获transformNode方法的错误 
   FormatXml = objXml.transformNode(objXsl) 
   If objXsl.parseError.errorCode <> 0 Then 
    Response.Write "<br><hr>" 
    Response.Write "Error Code: " & objXsl.parseError.errorCode 
    Response.Write "<br>Error Reason: " & objXsl.parseError.reason 
    Response.Write "<br>Error Line: " & objXsl.parseError.line 
    FormatXml = "<span class=""alert"">格式化XML文件错误!</span>" 
   End If 
  Else 
   Response.Write "<br><hr>" 
   Response.Write "Error Code: " & objXsl.parseError.errorCode 
   Response.Write "<br>Error Reason: " & objXsl.parseError.reason 
   Response.Write "<br>Error Line: " & objXsl.parseError.line 
   FormatXml = "<span class=""alert"">装载XSL文件错误!</span>" 
  End If  
 Else 
  Response.Write "<br><hr>" 
  Response.Write "Error Code: " & objXml.parseError.errorCode 
  Response.Write "<br>Error Reason: " & objXml.parseError.reason 
  Response.Write "<br>Error Line: " & objXml.parseError.line 
  FormatXml = "<span class=""alert"">装载XML文件错误!</span>" 
 End If 

 Set objXsl = Nothing 
 Set objXml = Nothing 
End Function
 
  四、操作Xml数据的Cls_Person类说明(clsPerson.asp)

Cls_Person类用来完成与联系人信息相关的各种操作,包括添加、修改和删除等等,它使用VBScript编写。Cls_Person包括Id、Name、
Nick、Mobile、Tel、Email、QQ和Company属性,对应于XML文件中的Person节点。Cls_Person包括GetInfoFromXml、AddToXml、EditToXml和
DeleteFormXml四个主要方法,分别完成获取信息,添加信息,修改信息和删除信息四个功能。

Cls_Person的具体实现如下, 



复制代码 代码如下:
'*************************************************** 
' 说明:Person类 
' 作者:gwd 2002-11-06 
' 引用:pub/constpub.asp 
'*************************************************** 

Class Cls_Person 

Private m_intId ' Id,对应Person节点在Persons集合中的位置 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3097.html