每条记录的XML解析 [英] XML parsing per record

查看:65
本文介绍了每条记录的XML解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想解析一个非常大的(2.4 gig)XML文件(生物信息学课程:))

但我不知道如何做到这一点。我看到的大多数内容都会立即读取整个xml

文件。那是不可能在这里工作的。


所以我想一次解析一个XML文件,然后能够

到将信息存储在另一个对象中。

我该怎么做?

提前致谢,


Willem Ligtenberg

顺便说一句蟒蛇的新手。

I want to parse a very large (2.4 gig) XML file (bioinformatics ofcourse :))
But I have no clue how to do that. Most things I see read the entire xml
file at once. That isn''t going to work here ofcourse.

So I would like to parse a XML file one record at a time and then be able
to store the information in another object.
How should I do that?

Thanks in advance,

Willem Ligtenberg
A total newbie to python by the way.

推荐答案

Willem Ligtenberg写道:
Willem Ligtenberg wrote:
我想解析一个非常大的(2.4 gig)XML文件(生物信息学课程:))
但我不知道如何做到这一点。我看到的大多数内容都会立即读取整个xml
文件。这不可能在这里工作。

所以我想一次解析一个XML文件,然后能够将信息存储在另一个对象中。我应该怎么做?

提前致谢,

Willem Ligtenberg
顺便说一句蟒蛇的新手。
I want to parse a very large (2.4 gig) XML file (bioinformatics ofcourse :))
But I have no clue how to do that. Most things I see read the entire xml
file at once. That isn''t going to work here ofcourse.

So I would like to parse a XML file one record at a time and then be able
to store the information in another object.
How should I do that?

Thanks in advance,

Willem Ligtenberg
A total newbie to python by the way.


这可能有所帮助:
http://www.devarticles.com/c/a/XML/P...AX-and-Python/

出于好奇,为什么数据存储在XML文件中?

XML因其效率而闻名.... br />

--Irmen


Read about SAX parsers.
This may be of help:
http://www.devarticles.com/c/a/XML/P...AX-and-Python/

Out of curiousity, why is the data stored in a XML file?
XML is not known for its efficiency....

--Irmen


Irmen de Jong写道:
Irmen de Jong wrote:
XML未知为了它的效率......
XML is not known for its efficiency....




< sarcasm>当然,你是亵渎神明,先生! XML是花生酱以来最好的东西

! < / sarcasm>


我只是在等待*当天有人在

卫生纸卷上使用它......哦辉煌的一天...



<sarcasm> Surely you are blaspheming, sir! XML''s the greatest thing
since peanut butter! </sarcasm>

I''m just *waiting* for the day someone finds its use on the rolls of
toilet paper... oh the glorious day...


Willem Ligtenberg写道:
Willem Ligtenberg wrote:
我想解析一个非常大的(2.4 gig)XML文件(生物信息学课程:))
但我不知道如何做到这一点。我看到的大多数内容都会立即读取整个xml
文件。这不可能在这里工作。

所以我想一次解析一个XML文件,然后能够将信息存储在另一个对象中。我应该怎么做?
I want to parse a very large (2.4 gig) XML file (bioinformatics ofcourse :))
But I have no clue how to do that. Most things I see read the entire xml
file at once. That isn''t going to work here ofcourse.

So I would like to parse a XML file one record at a time and then be able
to store the information in another object.
How should I do that?




您可能对使用ElementTree的这个食谱感兴趣:
http://online.effbot.org/2004_12_01_...ment-generator


Kent



You might be interested in this recipe using ElementTree:
http://online.effbot.org/2004_12_01_...ment-generator

Kent


这篇关于每条记录的XML解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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