| 域名空间 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 网络赚钱 | 网站地图 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
|
首先我们创建一个dll来封装sax的功能好了。 测试环境:win2k prof.+msxml3.0 sp1+vb6 要使用sax我们必须引用(reference)microsoft xml 3.0(我的机器安装的是msxml3.0 sp1) 工程名:saxtesting 类名:clssaxtest 方法:public function myxmlparser(xml文件物理路径) as domdocument 代码: option explicit public function myxmlparser(byval strxmlfilepath as variant) as domdocument dim reader as new saxxmlreader dim contenthandler as new contenthandlerimpl dim errorhandler as new errorhandlerimpl set reader.contenthandler = contenthandler set reader.errorhandler = errorhandler on error goto errorhandle dim xmlfile as string xmlfile = strxmlfilepath reader.parseurl (xmlfile) dim xmldoc as msxml2.domdocument set xmldoc = createobject("msxml2.domdocument") xmldoc.loadxml strxml set myxmlparser = xmldoc set xmldoc = nothing exit function errorhandle: err.raise 9999, "my xml parser", err.number & " : " & err.description end function 类名:modpublic 代码: option explicit global strxml as string 类名:contenthandlerimpl 代码: option explicit implements ivbsaxcontenthandler private sub ivbsaxcontenthandler_startelement(strnamespaceuri as string, strlocalname as string, strqname as string, byval attributes as msxml2.ivbsaxattributes) dim i as integer intlocker = intlocker + 1 if intlocker > 1 then end if strxml = strxml & "<" & strlocalname for i = 0 to (attributes.length - 1) strxml = strxml & " " & attributes.getlocalname(i) & "=""" & attributes.getvalue(i) & """" next strxml = strxml & ">" if strlocalname = "qu" then err.raise vbobjecterror + 1, "contenthandler.startelement", "found element <qu>" end if end sub 本新闻共2页,当前在第1页 1 2 本新闻共2页,当前在第1页 1 2 编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:掌握sax 下一篇:xml schema学习笔记 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 最新更新 | 热点排行 | 推荐新闻 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
| 友情链接 | ||||||
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||