English 中文(简体)
如何整合使用 javax. xml. transform 软件包转换 xml 文件的进展栏?
原标题:How to integrate progress bar in transformation of xml file using javax.xml.transform package?

我正在使用 javax. xml. transform 软件包来转换巨大的 XML 文件... 此过程需要很多时间..., 终端用户将无法看到进展 。 是否有任何方法可以将进度栏与转换过程整合 。

问题回答

我做了这种事情, 报告了迄今为止有多少输入文件被读取 。 例如, 将您在 < code> javax.swing. development MonitorInputStream 中读取输入的 XML 文件的 < InputStream 包起来, 然后将 < code>javax. xml. transform 从中读取 。

我的同事从远程 URL 输入时使用的模式是这样的:

URLConnection c = new URL(url).openConnection();
ProgressMonitorInputStream pm = new ProgressMonitorInputStream(parentComponent,
                "Transforming XML", c.getInputStream());
pm.getProgressMonitor().setMaximum(c.getContentLength());

// now read from  pm 

这与报告你的转型进展不相同, 但是只要转型不等到它读完整个文件后才能产生输出, 它就应该接近了。





相关问题
When test hanging in an infinite loop

I m tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here s the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> ...

quick xslt for-each question

Let s say I have an XML document that has this: <keywords> <keyword>test</keyword> <keyword>test2</keyword> <keyword>test3</keyword> <keyword>test4</...

XSLT Transform XML with Namespaces

I m trying to transform some XML into HTML using XSLT. Problem: I can t get it to work. Can someone tell me what I m doing wrong? XML: <ArrayOfBrokerage xmlns:i="http://www.w3.org/2001/...

XSLT output to HTML

In my XSLT file, I have the following: <input type="button" value= <xsl:value-of select="name">> It s an error as it violates XML rule. What I actually want is having a value from an ...

Mangling IDs and References to IDs in XML

I m trying to compose xml elements into each other, and the problem I am having is when there s the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the ...

Sharepoint 2007 Data view Webpart custom parameters

I m sort of new to the custom parameters that can be setup on a DataView Webpart. There are 6 options: - None - Control - Cookie - Form - QueryString - Server Variable I think that None, Cookie and ...

热门标签