<p>I'm using Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html" rel="nofollow noreferrer">Transformer</a> class to process an XML Document object.</p>

<p>This is the code that creates the Transformer:</p>

<pre><code>import javax.xml.transform.TransformerFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;

Transformer transformer = TransformerFactory.newInstance().newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "no");
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");

transformer.transform(source, result);
</code></pre>

<p>Currently, my output looks like this: &lt;svg ... /&gt;. I'd like it to include the namespace of each element, as in &lt;svg:svg ... /&gt;</p>

<p>How can I do that ?</p>

The package description for
javax.xml.transform
has a section
Qualified Name Representation
which seems to imply that it is possible to get the namespace represented in both input and output.
It isn't really clear to me what the result would look like, other than the namespace URI would be included.
Give it a try - hopefully someone else will have more concrete experience.