搜索在XML文件中的数据的最佳方式? [英] Best way to search data in xml files?

查看:89
本文介绍了搜索在XML文件中的数据的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的新项目,我们必须提供一个搜索功能,从数百个XML文件检索数据。我有我们的低于目前计划的简短,我想知道这对你的建议/改善。

In our new project we have to provide a search functionality to retrieve data from hundreds of xml files. I have a brief of our current plan below, I would like to know your suggestions/improvements on this.

这些XML文件中包含的个人信息,而搜索是基于它的10个元素,例如姓,名,电子邮件等。我们目前的计划是建立一个主XmlDocument的所有可搜索数据,并将关键实际文件。这样,当用户搜索数据,我们先来看看主文件并得到结果。我们还将从近期的搜索,以便呈三角搜索后能迅速处理缓存实际的XML文件。

These xml files contain personal information, and the search is based on 10 elements in it for example last name, first name, email etc. Our current plan is to create an master XmlDocument with all the searchable data and a key to the actual file. So that when the user searches the data we first look at master file and get the the results. We will also cache the actual xml files from the recent searches so simillar searches later can be handled quickly.

我们的应用程序是一个.NET 2.0的Web应用程序。

Our application is a .net 2.0 web application.

推荐答案

第一:有多大是XML文件? 的XmlDocument 没有规模庞大的......但可以处理大确定。

First: how big are the xml files? XmlDocument doesn't scale to "huge"... but can handle "large" OK.

第二:你可以或许把数据放到一个普通的数据库结构(也许SQL Server的防爆preSS版),它的索引,通过普通TSQL和访问?这通常会超出执行XPath搜索。同样的,如果它的结构,SQL Server 2005和以上支持 XML 数据类型,其中碎片的数据 - 这使您可以索引和查询无需在内存中的整个DOM数据库中的XML数据(其转换成的XPath关系查询)。

Second: can you perhaps put the data into a regular database structure (perhaps SQL Server Express Edition), index it, and access via regular TSQL? That will usually out-perform an xpath search. Equally, if it is structured, SQL Server 2005 and above supports the xml data-type, which shreds data - this allows you to index and query xml data in the database without having the entire DOM in memory (it translates xpath into relational queries).

这篇关于搜索在XML文件中的数据的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆