diff options
Diffstat (limited to 'src/rtfx.cpp')
| -rw-r--r-- | src/rtfx.cpp | 20 | 
1 files changed, 13 insertions, 7 deletions
| diff --git a/src/rtfx.cpp b/src/rtfx.cpp index 7576d51..a620498 100644 --- a/src/rtfx.cpp +++ b/src/rtfx.cpp @@ -57,19 +57,25 @@ int main(int argc, char* argv[])  	try  	{ +        // The input file  		FILE* file = fopen(argv[1], "rb");  		if(!file)  		{ -			fprintf(stderr, "rtfx: couldn't open file: %s: %s\n", argv[1], strerror(errno)); +			fprintf(stderr, "rtfx: couldn't open rtf file: %s: %s\n", argv[1], strerror(errno));  			return 1;  		} +        // Default options  		RtfParserOptions options; -		RtfParser handler(options); -		RtfReader rtf; -		rtf.setHandler(&handler); +        // Reads RTF tags and blocks +        RtfParser rtf; + +        // Interprets tags and blocks from RTFParser +		XMLComposer composer(options); +		rtf.setHandler(&composer); +  		bool ret = rtf.parse(file);  		fclose(file); @@ -79,8 +85,9 @@ int main(int argc, char* argv[])  			return 1;  		} - -		DOM::Document doc = handler.getDocument(); +        // TODO: This is disgusting. We need to bug the sablotron guys +        // for a better way to serialize a document. +		DOM::Document doc = composer.getDocument();  		string xml = doc.serialize();  		FILE* out = fopen(argv[2], "wb"); @@ -93,7 +100,6 @@ int main(int argc, char* argv[])  		fwrite(xml.c_str(), 1, xml.length(), out);  		fclose(out);  		return 0; -  	}  	catch(DOM::DOMException& e)  	{ | 
