title: MalformedURLException: no protocol with Xalan transformer
body: <p>I'm having trouble implementing a solution for this question on <a href="https://stackoverflow.com/questions/11672244/editing-a-large-xml-file-on-the-fly">editing an XML file in a stream</a>. I get a MalFormedUrlException: no protocol. The XML file is encoded as UTF-8, has no doctype but is well-formed. I'm stumped as to why this is happening.</p>
  
  <p>Here's the offending code (<code>byteArray</code> has the xml, <code>UpdatingXmlReader</code> is my class):</p>
  
  <pre><code>    XMLReader reader =
          new UpdatingXmlReader(SAXParserFactory.newInstance().newSAXParser());
      Transformer xform = TransformerFactory.newInstance().newTransformer();
  
      InputSource inputSource = 
          new InputSource(new ByteArrayInputStream(byteArray));
      StreamResult streamResult = 
          new StreamResult(response.getOutputStream());
  
      SAXSource saxSource = new SAXSource(reader, inputSource);                       
  
      xform.transform(saxSource, streamResult);
  </code></pre>
  
  <p>How it's called in my test:</p>
  
  <pre><code>    File file = new File("c:/test.xml");
      InputStream input = new FileInputStream(file);
      byte[] b = IOUtils.toByteArray(input);
      // in production the byte array will come from the database
      service.method(b, httpServletResponse ,httpServletRequest)
  </code></pre>
  
  <p>Here's the stacktrace:</p>
  
  <pre><code>javax.xml.transform.TransformerException: 
      java.net.MalformedURLException: no protocol: 
      at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Unknown Source)
  Caused by: java.net.MalformedURLException: no protocol: [B@22732273
      at java.net.URL.&lt;init&gt;(URL.java:579)
      at java.net.URL.&lt;init&gt;(URL.java:476)
      at java.net.URL.&lt;init&gt;(URL.java:425)
      at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
      at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
  </code></pre>