在非常大的文件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.