PDA

View Full Version : Obtaining clean (x)html from QTextEdit



ccf_h
5th February 2006, 12:16
Hi,
I need to get clean simple xhtml from QTextEdit. It's not a problem that QTextEdit supports only a part of the html language set but e.g. the paragraph should be only <p> and </p> instead of all the stuff QTextEdit adds. What comes to my mind is either trying to write a XSLT stylesheet and feed the output of a QTextEdit to a XSLT processor, or to kind of using QTextEdit's API, but this would be difficult and require writing a parser I suppose.
Any comments or ideas?

wysota
5th February 2006, 15:47
You can clean the output using a hand-written parser based on regular expressions. For example trying to match "<p.+>" and replacing it with "<p>".