msxsl.exe 的继承者?

发布于 2024-08-17 08:49:40 字数 135 浏览 3 评论 0 原文

我们打算将框架从 msxml4 迁移到 msxml6。 我们尚未使用 msxsl.exe。 它似乎仅支持 MSXML 版本高达 4.0,作为命令行 msxsl.exe -u 版本 6.0 告诉我。 msxsl.exe 有继承者吗? 有替代的命令行处理器吗?

We intend to migrate our framework from msxml4 to msxml6.
We where using msxsl.exe as yet.
It seems to support only MSXML versions up to 4.0, as command line
msxsl.exe -u version 6.0
tells me.
Is there a successor of msxsl.exe?
Any alternative command line processor?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

宣告ˉ结束 2024-08-24 08:49:40

有多种方法可以替换现有处理器,这仅取决于您需要什么级别的功能以及是否需要 MSXML 特定功能。例如,xsltproc是libxslt的一部分(可以从页面为您提供了 C# 中的快速替换,但两者都更改了命令行用法并且可能不会实现相同的 MSXML 扩展(xsltproc 当然不会)。

如果您只对使用 MSXML 6 的简单命令行处理器感兴趣,那么您可能会比使用简单的 JScript 应用程序做得更糟糕。将以下代码保存为 xsltr.js 并作为 cscript xsltr.js input.xml template.xsl output.txt 运行:

var adTypeBinary = 1;
var adSaveCreateOverWrite = 2;
var adSaveCreateNotExist = 1;

try
{
    var args = WScript.Arguments;

    if(args.length < 3)
    {
        WScript.Echo("Usage: xsltr.js file.xml file.xsl output.txt");
        WScript.Quit(1);
    }
    else
    {
        var xml = args(0);
        var xsl = args(1);
        var out = args(2);

        var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
        var xslDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");

        /* Create a binary IStream */
        var outDoc = new ActiveXObject("ADODB.Stream");
        outDoc.type = adTypeBinary;
        outDoc.open();

        if(xmlDoc.load(xml) == false)
        {
            throw new Error("Could not load XML document: " + xmlDoc.parseError.reason);
        }

        if(xslDoc.load(xsl) == false)
        {
            throw new Error("Could not load XSL document: " + xslDoc.parseError.reason);
        }

        xmlDoc.transformNodeToObject(xslDoc, outDoc);
        outDoc.SaveToFile(out, adSaveCreateOverWrite);
    }
}
catch(e)
{
    WScript.Echo(e.message);
    WScript.Quit(1);
}

仍然存在不能使用 msxsl 的理由吗? MSXML 4.0 版从来都不是标准安装,因此您始终必须手动安装它(尽管我认为它曾经随 Office 一起提供)。您不能在需要进行处理的机器上部署版本 4 吗?

There are a number of ways you could replace the existing processor, it just depends on what level of functionality you require and whether you need MSXML specific functionality. For example there is xsltproc which is part of libxslt (can get some windows binaries from here for example). This page gives you a quick replacement in C# but both change the command line usage and might not implement the same MSXML extensions (xsltproc certainly doesn't).

If you are just interested in a simple command line processor which uses MSXML 6 then you could do worse than using a simple JScript application. Save the following code as xsltr.js and run as cscript xsltr.js input.xml template.xsl output.txt:

var adTypeBinary = 1;
var adSaveCreateOverWrite = 2;
var adSaveCreateNotExist = 1;

try
{
    var args = WScript.Arguments;

    if(args.length < 3)
    {
        WScript.Echo("Usage: xsltr.js file.xml file.xsl output.txt");
        WScript.Quit(1);
    }
    else
    {
        var xml = args(0);
        var xsl = args(1);
        var out = args(2);

        var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");
        var xslDoc = new ActiveXObject("Msxml2.DOMDocument.6.0");

        /* Create a binary IStream */
        var outDoc = new ActiveXObject("ADODB.Stream");
        outDoc.type = adTypeBinary;
        outDoc.open();

        if(xmlDoc.load(xml) == false)
        {
            throw new Error("Could not load XML document: " + xmlDoc.parseError.reason);
        }

        if(xslDoc.load(xsl) == false)
        {
            throw new Error("Could not load XSL document: " + xslDoc.parseError.reason);
        }

        xmlDoc.transformNodeToObject(xslDoc, outDoc);
        outDoc.SaveToFile(out, adSaveCreateOverWrite);
    }
}
catch(e)
{
    WScript.Echo(e.message);
    WScript.Quit(1);
}

Still is there is a rationale you cannot use msxsl? Version 4.0 of MSXML has never been a standard installation so you would have always had to install it manually (though I think it came with Office at one point). Could you not deploy version 4 on the machines you need to do the processing on?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文