/*
* (C) Copyright The MITRE Corporation 1999 All rights reserved.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* The program provided "as is" without any warranty express or
* implied, including the warranty of non-infringement and the implied
* warranties of merchantibility and fitness for a particular purpose.
* The Copyright owner will not be liable for any damages suffered by
* you as a result of using the Program. In no event will the Copyright
* owner be liable for any special, indirect or consequential damages or
* lost profits even if the Copyright owner has been advised of the
* possibility of their occurrence.
*
* Please see release.txt distributed with this file for more information.
*
*/
#include "XSLProcessor.h"
//--------------/
//- Prototypes -/
//--------------/
/**
* Prints the command line help screen to the console
**/
void printHelp();
/**
* prints the command line usage information to the console
**/
void printUsage();
/**
* The TransforMiiX command line interface
* @author Keith Visco
**/
int main(int argc, char** argv) {
XSLProcessor xslProcessor;
String copyright("(C) 1999 The MITRE Corporation");
cout << xslProcessor.getAppName() << " ";
cout << xslProcessor.getAppVersion() << copyright <length()+1];
ifstream xmlInput(xmlFilename->toChar(chars), ios::in);
delete chars;
//-- create document base
String documentBase;
URIUtils::getDocumentBase(*xmlFilename, documentBase);
//-- handle output stream
ostream* resultOutput = &cout;
ofstream resultFileStream;
if ( outFilename ) {
chars = new char[outFilename->length()+1];
resultFileStream.open(outFilename->toChar(chars), ios::out);
delete chars;
if ( !resultFileStream ) {
cout << "error opening output file: " << *xmlFilename << endl;
return -1;
}
resultOutput = &resultFileStream;
}
//-- process
if ( !xslFilename ) {
xslProcessor.process(xmlInput, documentBase, *resultOutput);
}
else {
//-- open XSL file
chars = new char[xslFilename->length()+1];
ifstream xslInput(xslFilename->toChar(chars), ios::in);
delete chars;
xslProcessor.process(xmlInput, xslInput, *resultOutput);
}
resultFileStream.close();
return 0;
} //-- main
void printHelp() {
cout << "The following flags are available for use with TransforMiiX -";
cout<