如何编辑大型xml文件(250MB)? [英] How to edit a large xml file (250MB)?

查看:81
本文介绍了如何编辑大型xml文件(250MB)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编辑250MB的xml文件?我尝试使用UltraEdit,Visual

Studio,Eclipse,Stylus Studio和XMLSpy编辑器,但是这些程序不能读取这个文件,因为它太大了。 SmEdit只读取

文件的第一个MB,并且不支持UTF-8(我需要支持它的程序)。现在我使用

XVI32这是十六进制编辑器,但它只有编辑才有用

少量字符 - 删除和插入大字符

文件非常累人。


我不需要xml编辑器。它可以是没有xml验证的任何文本编辑器

等我不知道这样的程序应该如何工作,但在我看来

应该是这样的程序。

How can I edit an xml file which has 250MB? I tried to use UltraEdit, Visual
Studio, Eclipse, Stylus Studio and XMLSpy editors but these programs can''t
read this file because it is too big. SmEdit reads only the first MB of the
file and doesn''t support UTF-8 (I need program which supports it). Now I use
XVI32 which is hexadecimal editor, but it can be useful only is editing
small number of characters - deleting and inserting characters to large
files is very tiring.

I don''t need xml editor. It can be any text editor without xml validation
etc. I don''t know how such a program should work, but in my opinion there
should be such a program.

推荐答案

setar写道:
setar wrote:

如何编辑有250MB的xml文件?
How can I edit an xml file which has 250MB?



不要制作250MB大小的XML文件。


编辑很简单。所以,如果你甚至无法编辑它,你将如何处理它?b
b处理它?如果你在它上面运行XPath,你认为性能会是什么样?


XML在这些卷中很少(但很少),但是总的来说

它没有。如果你正在寻找一种基于流的格式(易于使用大量的b / b
),那么XML的单根元素约束将对你起作用
。如果你正在尝试构建一个数据库,那么XML缺乏高效的查询是一个性能损失。如果你想要250MB文件作为封装数据格式(可能是数据库中的ETL),那么它是可行的,

但文档生命周期相当短

create-transfer-load-delete。


因此,如果您的应用程序需要250MB数据实体,那么请仔细考虑
关于这些工具你正在使用生活可能会更简单。


我周围也有很多250MB文件,但我不会手工编辑它们。

我有电脑为我做那种事情。

Don''t make XML files that are 250MB in size.

Editing is simple. So if you can''t even edit it, how are you going to
process it? If you run XPath on it, what do you think performance will
be like?

There are (rare) times when XML works in these volumes, but in general
it doesn''t. If you''re looking for a stream-based format (easy to work
with in huge volumes) then XML''s single root element constraint works
against you. If you''re trying to build a database, then XML''s lack of
efficient querying is a performance hit. If you want 250MB files as an
encapsulated data format (maybe ETL on a database) then it''s workable,
but the document lifecycle is a fairly short
create-transfer-load-delete.

So if your application requires a 250MB data entity, then think
carefully about the tools you''re using. Life might be simpler that way.

I also have lots of 250MB files around, but I don''t edit them by hand.
I have computers to do that sort of thing for me instead.


setar写道:
setar wrote:

我不喜欢不需要xml编辑器。它可以是没有xml验证的任何文本编辑器

等我不知道这样的程序应该如何工作,但在我看来

应该是这样的程序。
I don''t need xml editor. It can be any text editor without xml validation
etc. I don''t know how such a program should work, but in my opinion there
should be such a program.



使用改进的vi编辑器vim。我已经用vi多次编辑了这样的

大型XML文件,你几乎没有注意到10 MB到200 MB文件之间的差异。

当前vim的版本(正确配置时)

也可以编辑任何UTF-8字符,例如日语。

Use vim, the improved vi editor. I have edited such
large XML files with vi several times and you hardly
notice the difference between 10 MB and 200 MB files.
Current versions of vim (when configured properly)
can also edit any UTF-8 characters, for example Japanese.


setar写道:
setar wrote:

如何编辑250MB的xml文件?
How can I edit an xml file which has 250MB?



当然,Emacs也支持UTF-8。


你有多少交换空间?假设你有一个相当聪明的编辑器

实现,这就是控制你的最大缓冲区大小的原因。 。或者

等价物。不足之处在于它不是互动的;你需要基本上编写一个程序来告诉它如何找到你需要改变的点数b / b你想要用它们做什么。


如果你宁愿留在XML世界,你可以根据SAX流找到或写一个流

编辑器;这是经典情况之一,

SAX可以优于基于DOM的处理。


或者查找/编写一个可以处理文档的工具块,无论是基于文本还是基于SAX的
。再一次,这假设你在做什么

分得很好。


这些方法/工具中哪一个最有意义取决于确切地说/>
你要对文件做什么。

-

()ASCII Ribbon Campaign | Joe Kesselman

/ \标记HTML电子邮件! |系统架构和动态诗歌

Emacs also supports UTF-8, of course.

How much swap space have you got? That''s what''s going to control your
maximum buffer size, assuming you''ve got a reasonably intelligent editor
implementation.

Another alternative is a stream editor -- the Unix tool "sed" or
something equivalent. Downside of that is that it isn''t interactive; you
have to essentially write a program that tells it how to find the points
you want changed and what you want done with them.

If you''d rather stay in the XML world, you could find or write a stream
editor based on SAX streams; this is one of the classic situations where
SAX can have advantages over DOM-based processing.

Or find/write a tool that will handle your document in chunks, either
text-based or SAX-based. Again, that presumes that what you''re doing
divides up nicely.

Which of these approaches/tools makes the most sense depends on exactly
what you''re trying to do to the file.
--
() ASCII Ribbon Campaign | Joe Kesselman
/\ Stamp out HTML e-mail! | System architexture and kinetic poetry


这篇关于如何编辑大型xml文件(250MB)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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