XML卷之实战锦囊(2)动态查询

来源:互联网 发布:襄阳程序员工资 编辑:程序博客网 时间:2024/05/29 02:24
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
动机:

查询功能是我们在网站上见过的最普遍也是最常用的一个功能模块了。以往的信息查询都是连接到数据库的,每一次点击都必须要后台数据库的支持。然而很多情况下用户往往只针对某一部分的数据进行操作,这样不但服务器的负担加重,而且严重的影响用户浏览的速度。

针对这种情况我们需要将用户需要的某一部分数据以XML的方式传递到客户端,用户对这些数据可以很方便的进行操作。既方便了用户,又减轻了服务器数据库的负担。何乐而不为呢!而且这项功能可以通用到其他众多模块,因此添加了这个动态查询功能。

材料:

XML卷之动态查询
有2个文件:search.XML 和 search.xsl

作用:

在不刷新页面的情况下对数据进行过滤筛选,有效的提高数据查询的功能。

效果:

代码:

search.XML

<?XML version="1.0" encoding="gb2312" ?>
<?XML-stylesheet type="text/xsl" href="search.xsl" ?>
<BlueIdea>
  <team>
   <blue_ID>1</blue_ID>
   <blue_name>Sailflying</blue_name>
   <blue_text>一个简单的查询</blue_text>
   <blue_time>2002-1-11 17:35:33</blue_time>
   <blue_class>XML专题</blue_class>
  </team>
  <team>
   <blue_ID>2</blue_ID>
   <blue_name>flyingbird</blue_name>
   <blue_text>嫁给你,是要你疼的</blue_text>
   <blue_time>2001-09-06 12:45:51</blue_time>
   <blue_class>灌水精华</blue_class>
  </team>
  <team>
   <blue_ID>3</blue_ID>
   <blue_name>苛子</blue_name>
   <blue_text>正则表达式在UBB论坛中的应用</blue_text>
   <blue_time>2001-11-23 21:02:16</blue_time>
   <blue_class>Web 编程精华</blue_class>
  </team>
  <team>
   <blue_ID>4</blue_ID>
   <blue_name>太乙郎</blue_name>
   <blue_text>年末经典分舵聚会完全手册 v0.1</blue_text>
   <blue_time>2000-12-08 10:22:48</blue_time>
   <blue_class>论坛灌水区</blue_class>
  </team>
  <team>
   <blue_ID>5</blue_ID>
   <blue_name>mmkk</blue_name>
   <blue_text>Asp错误信息总汇</blue_text>
   <blue_time>2001-10-13 16:39:05</blue_time>
   <blue_class>javascript脚本</blue_class>
  </team>
</BlueIdea>

<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击