请问如何从解析后的xml网页中按用户给出的主题抽取出模式?

dlga 2003-10-30 08:48:47
.book[0].title[0].#pcdata[0]
Data on the Web
.book[0].author[0].#pcdata[0]
Serge Abiteboul
.book[0].author[1].#pcdata[0]
Peter Buneman
.book[0].author[2].#pcdata[0]
Dan Suciu
.book[0].section[0].@[0]
intro
.book[0].section[0].@[0]
easy
.book[0].section[0].title[0].#pcdata[0]
Introduction
.book[0].section[0].p[0].#pcdata[0]
Text ...
.book[0].section[0].section[0].title[0].#pcdata[0]
Audience
.book[0].section[0].section[0].p[0].#pcdata[0]
Text ...
.book[0].section[0].section[1].title[0].#pcdata[0]
Web Data and the Two Cultures
.book[0].section[0].section[1].p[0].#pcdata[0]
Text ...
.book[0].section[0].section[1].figure[0].@[0]
400
.book[0].section[0].section[1].figure[0].@[0]
400
.book[0].section[0].section[1].figure[0].title[0].#pcdata[0]
Traditional client/server architecture
.book[0].section[0].section[1].figure[0].image[0].@[0]
csarch.gif
.book[0].section[0].section[1].p[1].#pcdata[0]
Text ...
.book[0].section[1].@[0]
syntax
.book[0].section[1].@[0]
medium
.book[0].section[1].title[0].#pcdata[0]
A Syntax For Data
.book[0].section[1].p[0].#pcdata[0]
Text ...
.book[0].section[1].figure[0].@[0]
200
.book[0].section[1].figure[0].@[0]
500
.book[0].section[1].figure[0].title[0].#pcdata[0]
Graph representations of structures
.book[0].section[1].figure[0].image[0].@[0]
graphs.gif
.book[0].section[1].p[1].#pcdata[0]
Text ...
.book[0].section[1].section[0].title[0].#pcdata[0]
Base Types
.book[0].section[1].section[0].p[0].#pcdata[0]
Text ...
.book[0].section[1].section[1].title[0].#pcdata[0]
Representing Relational Databases
.book[0].section[1].section[1].p[0].#pcdata[0]
Text ...
.book[0].section[1].section[1].figure[0].@[0]
250
.book[0].section[1].section[1].figure[0].@[0]
400
.book[0].section[1].section[1].figure[0].title[0].#pcdata[0]
Examples of Relations
.book[0].section[1].section[1].figure[0].image[0].@[0]
relations.gif
.book[0].section[1].section[2].title[0].#pcdata[0]
Representing Object Databases
.book[0].section[1].section[2].p[0].#pcdata[0]


以上是对如下一个xml网页的解析:
<?xml version="1.0" ?>
<!DOCTYPE book (View Source for full doctype...)>
- <book>
<title>Data on the Web</title>
<author>Serge Abiteboul</author>
<author>Peter Buneman</author>
<author>Dan Suciu</author>
- <section id="intro" difficulty="easy">
<title>Introduction</title>
<p>Text ...</p>
- <section>
<title>Audience</title>
<p>Text ...</p>
</section>
- <section>
<title>Web Data and the Two Cultures</title>
<p>Text ...</p>
- <figure height="400" width="400">
<title>Traditional client/server architecture</title>
<image source="csarch.gif" />
</figure>
<p>Text ...</p>
</section>
</section>
- <section id="syntax" difficulty="medium">
<title>A Syntax For Data</title>
<p>Text ...</p>
- <figure height="200" width="500">
<title>Graph representations of structures</title>
<image source="graphs.gif" />
</figure>
<p>Text ...</p>
- <section>
<title>Base Types</title>
<p>Text ...</p>
</section>
- <section>
<title>Representing Relational Databases</title>
<p>Text ...</p>
- <figure height="250" width="400">
<title>Examples of Relations</title>
<image source="relations.gif" />
</figure>
</section>
- <section>
<title>Representing Object Databases</title>
<p>Text ...</p>
</section>
</section>
</book>

请问如何从解析后xml网页(不止一个但都是关于同一主题的入本例是关于book的)的结果中抽取出关于这类主题的xml网页模式,这个模式能大概的描述出关于这类主题(如book或company)的xml网页的出现规律,可以利用这个模式到网上进行搜索查询,获得较高精确度的搜索结果。
多谢了,如果有那位知道那里有这方面的资料也可以,在一次表示感谢,我已经被折腾的不行了,急!急!!
...全文
43 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

51,407

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧