Is there a ready-made tool or utility that does that already
views:
64answers:
1
Q:
How can I use Java to programmaticaly convert an Internal Stylesheet of a web-page to an inline one?
+1
A:
You could just open the CSS file and just embed its content into a style tag.
It should not be that hard:
FileReader frCSS = new FileReader("your_css.css");
FileReader frHTML = new FileReader("your_html.html");
FileWriter output = new FileWriter("result.html");
Then parse frHTML and copy its content to output until you find the head opening tag. When you do, open a style tag and copy all contents from frCSS. Then, close the style tag and copy the remaining portion of frHTML.
It's not pretty, but it can be done.
Pablo Santa Cruz
2009-05-05 10:30:37
That would convert an External Stylesheet to Internal.I am interested in converting internal to inline, if possible, without the heavylifting of doing all the parsing myself...
Oren Yosifon
2009-05-07 12:17:20