hey guys. i'm using xalan's jaxp implementation to transform a sax stream
into a text stream, nothing exciting. code fragment is:
public static void printObjectAsXML(Base base, OutputStream output)
throws TransformerConfigurationException,SAXException {
//FIXME - this is what the docs say to do, but is it safe???
SAXTransformerFactory factory =
(SAXTransformerFactory)TransformerFactory.newInstance();
TransformerHandler handler = factory.newTransformerHandler();
handler.getTransformer().setOutputProperty(OutputKeys.METHOD,"xml");
handler.getTransformer().setOutputProperty(OutputKeys.INDENT,"yes");
StreamResult result = new StreamResult(output);
handler.setResult(result);
handler.startDocument();
handler.startPrefixMapping(prefix,urlspace);
base.toXML(handler);
handler.endPrefixMapping(prefix);
handler.endDocument();
}
problem is, the namespace declaration doesn't appear in the output. i'm
sure this is simple, probably i need to set a feature somewhere, but i've
been poring over docs for about an hour now to no avail. any suggestions?
- donald