通过命令行转换 XML 至 JSON、XML、CSV、PDF
Windows
2000/2003/Vista/7/8/10/11
and
2012/2016/2019/2022 Server
and
Docker/Citrix/Wine
如果您正在寻找命令行 XML 转换器,那么无需再寻找了。Total XML ConverterX 将帮助您格式化 XML 文件或促进系统之间的数据交换。CoolUtils 拥有将近十年的各种转换器经验,为产品质量提供保证。现在下载免费试用版并进行 30 天的测试。
string src="C:\\test\\Source.XML"; string dest="C:\\test\\Dest.PDF"; XMLConverterX Cnv = new XMLConverterX(); Cnv.Convert(src, dest, "-c PDF -log c:\\test\\XML.log"); MessageBox.Show("Convert complete!");
dim C Set C=CreateObject("XMLConverter.XMLConverterX") C.Convert "c:\source.XML", "c:\dest.JSON", "-cJSON -log c:\XML.log" set C = nothing
dim C Set C=CreateObject("XMLConverter.XMLConverterX") Response.Clear Response.AddHeader "Content-Type", "binary/octet-stream" Rresponse.AddHeader "Content-Disposition", "attachment; filename=test.JSON" Response.BinaryWrite c.ConvertToStream("C:\www\ASP\Source.XML", "C:\www\ASP", "-cJSON -log c:\XML.log") set C = nothing
$src="C:\test.XML\"; $dest="C:\test.XLS\"; if (file_exists($dest)) unlink($dest); $c= new COM("PDFConverter.PDFConverterX"); $c->convert($src,$dest, "-c XLS -log c:\pdf.log"); if (file_exists($dest)) echo "OK"; else echo "fail:".$c->ErrorMessage;
require 'win32ole' c = WIN32OLE.new('XMLConverter.XMLConverterX') src="C:\\test\\test.XML"; dest="C:\\test\\test.pdf"; c.convert(src,dest, "-c PDF -log c:\\test\\XML.log"); if not File.exist?(dest) puts c.ErrorMessage end
import win32com.client import os.path c = win32com.client.Dispatch("XMLConverter.XMLConverterX") src="C:\\test\\test.XML"; dest="C:\\test\\test.pdf"; c.convert(src, dest, "-c PDF -log c:\\test\\XML.log"); if not os.path.exists(file_path): print(c.ErrorMessage)
uses Dialogs, Vcl.OleAuto; var c: OleVariant; begin c:=CreateOleObject('XMLConverter.XMLConverterX'); C.Convert('c:\test\source.XML', 'c:\test\dest.pdf', '-cPDF -log c:\test\XML.log'); IF c.ErrorMessage<> Then ShowMessage(c.ErrorMessage); end;
$src="C:\test.XML\"; $dest="C:\test.XLS\"; if (file_exists($dest)) unlink($dest); $c= new COM("PDFConverter.PDFConverterX"); $c->convert($src,$dest, "-c XLS -log c:\pdf.log"); if (file_exists($dest)) echo "OK"; else echo "fail:".$c->ErrorMessage;
use Win32::OLE; my $src="C:\\test\\test.XML"; my $dest="C:\\test\\test.pdf"; my $c = CreateObject Win32::OLE 'XMLConverter.XMLConverterX'; $c->convert($src,$dest, "-c pdf -log c:\\test\\XML.log"); print $c->ErrorMessage if -e $dest;
#includestatic const CLSID CLSID_XMLConverterX = {0x6B411E7E, 0x9503,0x4793,{0xA2, 0x87, 0x1F, 0x3B, 0xA8, 0x78, 0xB9, 0x1C}}; static const IID IID_IXMLConverterX = {0xEF633BED, 0xC414,0x49B0,{0x91, 0xFB, 0xC3, 0x9C, 0x3F, 0xE0, 0x08, 0x0D}}; #undef INTERFACE #define INTERFACE IXMLConverterX DECLARE_INTERFACE_(IXMLConverterX, IDispatch) { STDMETHOD(QueryInterface)(THIS_ REFIID, PVOID*) PURE; STDMETHOD(Convert)(THIS_ LPCTSTR, LPCTSTR, LPCTSTR) PURE; STDMETHOD(About)(THIS) PURE; //const SourceFile: WideString; const DestFile: WideString; const Params: WideString; safecall; }; typedef HRESULT (__stdcall *hDllGetClassObjectFunc) (REFCLSID, REFIID, void **); int main () { HRESULT hr; if (CoInitialize(NULL)) { printf ("Error in CoInitialize."); return -1; } LPCTSTR lpFileName = "XMLConverter.dll"; HMODULE hModule; hModule = LoadLibrary (lpFileName); printf ("hModule: %d\n", hModule); if (hModule == 0) { printf ("Error in LoadLibrary."); return -1; } hDllGetClassObjectFunc hDllGetClassObject = NULL; hDllGetClassObject = (hDllGetClassObjectFunc) GetProcAddress (hModule, "DllGetClassObject"); if (hDllGetClassObject == 0) { printf ("Error in GetProcAddress."); return -1; } IClassFactory *pCF = NULL; hr = hDllGetClassObject (&CLSID_XMLConverterX, &IID_IClassFactory, (void **)&pCF); /* Can't load with different ID */ printf ("hr hDllGetClassObject: %d\n", hr); if (!SUCCEEDED (hr)) { printf ("Error in hDllGetClassObject."); return -1; } IXMLConverterX *pIN; hr = pCF->lpVtbl->CreateInstance (pCF, 0, &IID_IXMLConverterX, (void **)&pIN); printf ("hr CreateInstance: %d\n", hr); if (!SUCCEEDED (hr)) { printf ("Error in hDllGetClassObject."); return -1; } hr = pCF->lpVtbl->Release (pCF); printf ("hr Release: %d\n", hr); if (!SUCCEEDED (hr)) { printf ("Error in Release."); return -1; } hr = pIN->lpVtbl->About (pIN); printf ("hr About: %d\n", hr); if (!SUCCEEDED (hr)) { printf ("Error in About."); return -1; } hr = pIN->lpVtbl->Convert (pIN, "test.pdf", "test.html","-cHTML"); printf ("hr Convert: %d\n", hr); if (!SUCCEEDED (hr)) { printf ("Error in Convert."); return -1; } return 0; }
"Total XML ConverterX 似乎非常适合我的使用,尽管我们只用它来将旧的 .xml 文件转换为其他格式。”
"我们选择这个程序是因为它能够处理 XSLT 文件。我们有超过 6000 个 XML,转换器在不到一小时内完成了工作!谢谢!”
Jean Robitaille | Sparktown Christian School