在非常大的文件XSLT转换 [英] XSLT transformations on very large files

查看:143
本文介绍了在非常大的文件XSLT转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用XSLT来产生我们的数据报告。该数据被存储在Oracle作为XML文档(未使用XML类型,但正常CLOB)。我们选择正确的XML文档,并创建一个单独的文档:

We are using XSLT to generate reports of our data. The data is currently stored in Oracle as XML documents (not using the XML type, but normal CLOB). We select the right XML documents and create a single document:

<DATABASE>
   <XMLDOCUMENT> ... </XMLDOCUMENT>
   <XMLDOCUMENT> ... </XMLDOCUMENT>
   ...
</DATABASE>

在一些情况下,完整的XML文档包含100000文档。这意味着一个巨大的XML文档被装载到第一内存,导致各种内存问题。

In some cases, the complete XML document contains +100000 documents. This means that a huge XML document is loaded first into memory, causing all kinds of memory issues.

我们怎样才能prevent这种情况的发生?我们在.NET 2.0使用XslCompiledTransform类。

How can we prevent this from happening? We are using the XslCompiledTransform class in .NET 2.0.

我知道有2种形式解析XML文档:DOM和SAX。但据我了解这一点,SAX方式是不可能与XSLT结合。 DOM的解析方法,迫使我们将整个事情到内存中。

I know that there are 2 forms of parsing XML documents: DOM and SAX. But as I understand this, the SAX way is not possible in combination with XSLT. The DOM parsing method forces us to load the entire thing into memory.

什么是我们的选择?它是否有助于先写完整的文件到硬盘? Oracle是否大XSLT转换进行更好的工作?

What are our options? Does it help to first write the complete document to disk? Does Oracle perform a better job on large XSLT transformations?

推荐答案

根据你想做的事,什么样的​​变革 STX 可能是一种替代XSLT:

Depending on what kinds of transformations you want to do, STX might be an alternative to XSLT:

流转换为XML   (STX)是一个一通转换   语言XML文档。 STX是   打算作为高速,低存储器   消费替代XSLT,使用   在W3C的XQuery 1.0和XPath 2.0数据   模型。因为STX不需要   建设一个内存树,它   适合在资源使用   受限的情况。

Streaming Transformations for XML (STX) is a one-pass transformation language for XML documents. STX is intended as a high-speed, low memory consumption alternative to XSLT, using the W3C XQuery 1.0 and XPath 2.0 Data Model. Since STX does not require the construction of an in-memory tree, it is suitable for use in resource constrained scenarios.

这篇关于在非常大的文件XSLT转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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