XSLT处理大量XML文件(差不多5 GB) [英] XSLT to process huge XML files (Almost 5 GB)

查看:123
本文介绍了XSLT处理大量XML文件(差不多5 GB)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一个使用XSLT来转换大量XML文件的一致解决方案(差不多5 GB)

I am trying to find a consistent solution using XSLT to transform huge XML files (Almost 5 GB)

Hier是我迄今为止尝试过的:

Hier is what I have tried until now:


  1. 从命令行使用MSXML Parser 4.0(SP3):

> msxsl.exe myfile.xml mysheet.xslt -o output.xml

>msxsl.exe myfile.xml mysheet.xslt -o output.xml

内存不足(代码:0x8007000e),文件大于800MB。

This runs out of memory (Code: 0x8007000e) with files bigger than 800MB.


  1. 使用Mozilla Firefox或IE通过处理指令应用XSLT:

<?xml version ='1.0'coding ='UTF-8'?>

<?xml version='1.0' encoding='UTF-8'?>

< ?xml-stylesheet href =mysheet.xslttype =text / xsl?>

<?xml-stylesheet href="mysheet.xslt" type="text/xsl" ?>

< root> ...

<root>...

浏览器在几分钟后崩溃。

The browser crashes after a couple of minutes.


  1. 尝试在Windows上用PHP编写我自己的XML-Reader(Ver 5.4.22)并选择XPath所需的元素

<?php

ini_set('max_execution_time',0);

ini_set('max_execution_time', 0);

ini_set('memory_limit',' - 1');

ini_set('memory_limit', '-1');

$ xml = simplexml_load_file('myfile。 xml');

$xml = simplexml_load_file('myfile.xml');

foreach($ xml-> xpath('/ root / node / atribute [@ id =value]')as $ result){

foreach($xml->xpath('/root/node/atribute[@id="value"]') as $result){

...

...... ...

... ...

}

...
...... ...

... ... ...

阿帕奇服务器崩溃。

请告诉你在这方面的经历......用Java编写课程怎么样?

Please tell about your experiences in this area... What about writing a class in Java?

PS我不想使用像XmlSplit这样的软件!

P.S. I don´t want to use software like XmlSplit or something!

推荐答案

对于5Gb源文档,你需要一个流媒体处理器,这意味着XSLT 3.0,目前有两个实现,Saxon-EE和Exselt。当然,并非所有转换都是可流式的(例如,排序很棘手),但是如果你描述了你想要执行的转换,或者给它一个非流式版本,那么我相信我们可以帮助你转变为在流媒体下工作的东西。

For a 5Gb source document you'll need a streaming processor, and that means XSLT 3.0, which currently has two implementations, Saxon-EE and Exselt. Of course, not all transformations are streamable (sorting is tricky, for example), but if you describe the transformation you want to perform, or give a non-streaming version of it, then I'm sure we can help you to turn into something that works under streaming.

这篇关于XSLT处理大量XML文件(差不多5 GB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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