Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

  1. /*
  2. convert.js
  3. Windows Scripting Host file for running the xdr-xsd-converter.xsl
  4. stylesheet.
  5. Parameters: xml-data-reduced-file [xml-schema-file]
  6. Author: Jonathan Marsh <jmarsh@microsoft.com>
  7. Copyright 2000 Microsoft Corp.
  8. */
  9. var args = WScript.arguments;
  10. if (args.length != 2 && args.length !=1)
  11. alert("parameters are: xml-data-reduced-file [xml-schema-file]");
  12. else
  13. {
  14. var ofs = WScript.CreateObject("Scripting.FileSystemObject");
  15. var stylesheet = ofs.GetAbsolutePathName(args.item(0));
  16. var converter = ofs.getAbsolutePathName("xdr-xsd-converter.xsl");
  17. var pp = ofs.getAbsolutePathName("pretty-printer.xsl");
  18. if (args.length < 2)
  19. var dest = ofs.getAbsolutePathName(args.item(0)) + ".xsd";
  20. else
  21. var dest = ofs.getAbsolutePathName(args.item(1));
  22. var oXML = new ActiveXObject("MSXML2.DOMDocument");
  23. oXML.validateOnParse = false;
  24. oXML.async = false;
  25. //oXML.preserveWhiteSpace = true;
  26. oXML.load(stylesheet);
  27. var oXSL = new ActiveXObject("MSXML2.DOMDocument");
  28. oXSL.validateOnParse = false;
  29. oXSL.async = false;
  30. oXSL.load(converter);
  31. var oResult = new ActiveXObject("MSXML2.DOMDocument");
  32. oResult.validateOnParse = false;
  33. oResult.async = false;
  34. oXML.transformNodeToObject(oXSL, oResult);
  35. var oFile = ofs.CreateTextFile(dest);
  36. oFile.Write(oResult.xml);
  37. oFile.Close();
  38. }