URIUtils::getDocumentBase(*xmlFilename, documentBase);
int main(int argc, char** argv) {    XSLTProcessor xsltProcessor;    String copyright("(C) 1999 The MITRE Corporation, Keith Visco, and contributors");    cout << xsltProcessor.getAppName() << " ";    cout << xsltProcessor.getAppVersion() << endl;    cout << copyright <<endl;    //-- print banner line    Int32 fillSize = 1;    fillSize += copyright.length();    String fill;    fill.setLength(fillSize, '-');    cout << fill <<endl<<endl;    //-- add ErrorObserver    SimpleErrorObserver seo;    xsltProcessor.addErrorObserver(seo);    //-- available flags    StringList flags;    flags.add(new String("i"));          // XML input    flags.add(new String("s"));          // XSL input    flags.add(new String("o"));          // Output filename    NamedMap options;    options.setObjectDeletion(MB_TRUE);    CommandLineUtils::getOptions(options, argc, argv, flags);    if ( options.get("h") ) {        printHelp();        return 0;    }    String* xmlFilename = (String*)options.get("i");    String* xsltFilename = (String*)options.get("s");    String* outFilename = (String*)options.get("o");    if ( !xmlFilename ) {        cout << "error: missing XML filename."<<endl <<endl;        printUsage();        return -1;    }    char* chars = 0;    //-- open XML file    chars = new char[xmlFilename->length()+1];    ifstream xmlInput(xmlFilename->toCharArray(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->toCharArray(chars), ios::out);        delete chars;        if ( !resultFileStream ) {            cout << "error opening output file: " << *xmlFilename << endl;            return -1;        }        resultOutput = &resultFileStream;    }    //-- process    if ( !xsltFilename ) {        xsltProcessor.process(xmlInput, *resultOutput, documentBase);    }    else {        //-- open XSLT file        chars = new char[xsltFilename->length()+1];        ifstream xsltInput(xsltFilename->toCharArray(chars), ios::in);        delete chars;        xsltProcessor.process(xmlInput, xsltInput, *resultOutput, documentBase);    }    resultFileStream.close();    return 0;} //-- main