I'm trying to serialize to an ByteArrayOutputStream as follows:
  ByteArrayOutputStream docbookOutputStream = null;
  File xmlFile = serializeFile;
  serializedOutput = new Serializer();
  serializedOutput.setOutputProperty(Serializer.Property.METHOD, "xml");
  PrintWriter xmlOut = new PrintWriter(xmlFile);
If I run this I get the following error:

No system ID supplied for result file

at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:233)


If I use the commented setOutputFile(xmlFile) and comment out the OutputStream code it works fine. What do I need to do to get an OutputStream that I can work with (no I don't just want to print it out :-)