I’m creating an XML document. I got it to indent using
TransformerFactory.setAttribute("indent-number", new Integer(2));
Transformer.setOutputProperty(OutputKeys.INDENT, "yes");
Is it possible to get Java to use tabs instead of spaces for indenting? And how?
No, not in general. The XSLT specification does not allow for specifying WHAT whitespace to use when indenting.
It might, however, be a XSLT-processor specific item to configure. Check the documentation for the one you are using.
If you REALLY want this, then you can use an afterburner XSLT-script on the output which does whatever you want to do on text()-nodes.