#ifdef _MSC_VER #pragma warning(disable: 4250) #endif #include #include #include #include int main(int argc, const char* argv[]) { if(argc == 1) { std::cout << "taggle [file1] [file2] ... [filen]\n" << " taggle reads arbitrary HTML, outputting it as well-formed XML\n"; return 0; } // if(argc == 1) Arabica::SAX::Taggle parser; std::ostringstream sink; Arabica::SAX::Writer writer(sink, 4); Arabica::SAX::CatchErrorHandler eh; writer.setParent(parser); writer.setErrorHandler(eh); for(int i = 1; i < argc; ++i) { std::string file(argv[i]); Arabica::SAX::InputSource is; is.setSystemId(file); if(file != "-") writer.parse(is); else { is.setSystemId("stdin"); is.setByteStream(std::cin); writer.parse(is); } // if(file != "-") if(eh.errorsReported()) { std::cerr << eh.errors() << std::endl; eh.reset(); } // if ... std::cout << sink.str(); } // for ... return 0; } // main