July 2005

Java Document to String

This is a very simple utility function to produce an indented XML document as a String given a Document. It throws a TransformerException if anything drastic goes wrong. [java] import java.io.*; import org.w3c.dom.Document; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; … public static String documentToString( Document document ) throws TransformerException { TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = …

Java Document to String Read More »

Java Object Digester

I was working on a web-based application recently and wanted a lazy way to get data from a simple ‘value object’ out to the front end without having any hard-coded field names; I came up with this. Basically, this method will take any Object, iterate through its methods looking for any of the format “get<something>” …

Java Object Digester Read More »

Unicode? Character Sets? UTF-what?

I was inspired to add this note after recent frustrations about the complete ignorance of character sets in both Commercial & Open software… I seriously recommend everyone reads the following, less ISO-blahblahblah and more UTF-8, no excuses! The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html

Scroll to Top