Homepageseo.com
Login
登录[Login]
Reg
注册[Reg]
Member
会员[Member]
BBs
论坛[BBs]
logout
退出[Logout]
Search
搜索[Search]
Search For:        Advanced Search   
Guide: 首页 >> IT技术专栏 >> 建站技术 >> 将SAX加入我们的ASP应用中(2)

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

作者: zhepu 来源: 互联网 日期: 2008-07-24,12:28

 

将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
%>

责任编辑: admin 参与评论
免责申明: 本网转载内容均来自互联网,本网并不保证其内容的真实性。如果您认为本网站某部分的内容有侵权嫌疑,敬请立即通知我们,我们将在第一时间予以更改或删除。
Copyright © 2006 HomepageSeo.com ®. All rights reserved. Website development by 八桂网络科技 Author:Homepage 桂ICP备06012988号