There is (probably) no way to indent (format as I wish) XML Signature elments created through xmldsig Java API. It would be helpful to have a way to indenting XML output like in javax.xml.transform TransformerFactory and Transformer classes throgh tf.setAttribute("indent-number", new Integer(2)) and t.setOutputProperty(OutputKeys.INDENT, "yes"); Post-creation transformation cannot be used in conjuction with standard canonicalization methods (CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS, CanonicalizationMethod.EXCLUSIVE, CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS,CanonicalizationMethod.INCLUSIVE), so there is no way to achive "pretty print".
Yes, we currently don't support this feature. Because pretty-printing after the signature is generated invalidates the signature, it must be done before the signature is generated. I'll look into this a bit more to see how difficult it would be to add.