将SAX加入我们的ASP应用中(2)

 

将SAX加入我们的ASP应用中(2)

[ 作者: hydnoahark   添加时间: 2001-7-25 20:10:21 ]


 


strqname as string)
  
   strxml = strxml & "</" & strlocalname & ">"
  
end sub

private sub ivbsaxcontenthandler_characters(text as string)
   text = replace(text, vblf, vbcrlf)
   strxml = strxml & text
  
end sub

private property set ivbsaxcontenthandler_documentlocator(byval rhs as msxml2.ivbsaxlocator)

end property

private sub ivbsaxcontenthandler_enddocument()

end sub

private sub ivbsaxcontenthandler_endprefixmapping(strprefix as string)

end sub

private sub ivbsaxcontenthandler_ignorablewhitespace(strchars as string)

end sub

private sub ivbsaxcontenthandler_processinginstruction(target as string, data as string)
  
   strxml = strxml & "<?" & target & " " & data & ">"

end sub

private sub ivbsaxcontenthandler_skippedentity(strname as string)

end sub

private sub ivbsaxcontenthandler_startdocument()

end sub

private sub ivbsaxcontenthandler_startprefixmapping(strprefix as string, struri as string)

end sub


类名:errorhandlerimpl
代码:
option explicit

implements ivbsaxerrorhandler


private sub ivbsaxerrorhandler_fatalerror(byval lctr as ivbsaxlocator, msg as string, byval

errcode as long)
      
       strxml = strxml & "*** error *** " & msg
  
end sub

private sub ivbsaxerrorhandler_error(byval lctr as ivbsaxlocator, msg as string, byval errcode as

long)
  
end sub

private sub ivbsaxerrorhandler_ignorablewarning(byval olocator as msxml2.ivbsaxlocator,

strerrormessage as string, byval nerrorcode as long)

end sub


ok,让我们编译这个dll,应该是没什么问题了。让我们在asp中看看运行的结果怎么样:
xml文件:
<?xml version="1.0"?>
<root foo="bar.com">
<parts>
 <part foo="bar.com"  foo2="bar.com">
<partno>12345</partno>
<description>vip - very important part</description>
 </part>
 <part>
<partno>5678</partno>
<description>lip - less important part</description>
 </part>
</parts>
</root>

asp文件:
<%
set a = createobject("saxtesting.clssaxtest")
set xmldoc = a.myxmlparser("d:/test.xml")
response.contenttype="text/xml"
response.write xmldoc.xml
set xmldoc=nothing
set a=nothing
%>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值