如何将字符串变量而不是文件名参数传递给TIDY? [英] How to pass a string variable to TIDY instead of a file name parameter?

查看:50
本文介绍了如何将字符串变量而不是文件名参数传递给TIDY?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此命令行来整理SVG文件的XML内容:

I use this command-line to tidy the XML content of an SVG file:

Winapi.ShellAPI.ShellExecute(Handle, 'open', 'cmd.exe', '/K tidy.exe -q -xml input.svg', nil, SW_SHOWNORMAL);

但是,我将XML内容包含在字符串变量中.因此,我必须将字符串变量保存到"input.svg"目录中.在执行上述命令行之前.

However, I have the XML content in a string variable. So I have to save the string variable to "input.svg" before executing the above command-line.

如何直接将字符串变量作为TIDY的参数传递,而不必将字符串变量保存到"input.svg"中.文件?

How can I pass the string variable DIRECTLY as a parameter for TIDY instead of having to save the string variable to "input.svg" file?

推荐答案

手册立即提及:

如果未指定输入文件,则Tidy读取标准输入.如果未指定输出文件,则Tidy将整理后的标记写入标准输出.

If no input file is specified, Tidy reads the standard input. If no output file is specified, Tidy writes the tidied markup to the standard output.

如何使用管道进行操作与 Delphi 无关-它基本上是在调用 CreateProcess(),并且我敢肯定有

How to operate with pipes is unbound to Delphi - it's basically calling CreateProcess() and I'm sure there are lots of examples to find. If you're stuck then ask a new question about your particular problem.

HTML Tidy 也带有一个DLL ,该DLL甚至可以比一次又一次地启动新流程要好.或涉及不需要的命令行.

HTML Tidy also comes with a DLL that might be even better than launching new processes again and again. Or involving the command line which is not needed in any way.

这篇关于如何将字符串变量而不是文件名参数传递给TIDY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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