XMLOutputFactory output = XMLOutputFactoryBase.newInstance();
output.setProperty(javax.xml.stream.XMLOutputFactory.IS_REPAIRING_NAMESPACES,new Boolean(true));
Writer myWriter = new java.io.OutputStreamWriter(
new java.io.FileOutputStream("tmp"),"us-ascii");
XMLStreamWriter writer2 = output.createXMLStreamWriter(myWriter);
writer2.writeStartDocument();
writer2.setPrefix("c","http://c");
writer2.setDefaultNamespace("http://d");
writer2.writeStartElement("http://c","a");
writer2.writeAttribute("b","blah");
writer2.writeEmptyElement("http://c","d");