I find myself constantly finding the same code over and over again, so they will start getting posted. To start off, here’s how to take a Document Object Model (XML Document) and convert it to a String:
TransformerFactory transfac = TransformerFactory.newInstance(); Transformer trans = transfac.newTransformer(); trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); trans.setOutputProperty(OutputKeys.INDENT, "yes"); StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); DOMSource source = new DOMSource(doc); trans.transform(source, result); return sw.toString();
#1 by Sam at September 10th, 2009
| Quote
Can you give an example of it in action?
#2 by Sam at September 10th, 2009
| Quote
Also, is there some intentional irony in the fact that your motto is the same as Fujitsu’s?
#3 by samuel Coskey at September 16th, 2009
| Quote
dude, i check your web site more than you do.
have you considered ditching the blog and just using the static content pages? you could just have a page for “code i always use” and people could see which pages have been updated recently.