code:   public void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream, UpdateRequestProcessor processor) throws Exception {
      final String charset = ContentStreamBase.getCharsetFromContentType(stream.getContentType());
      
      InputStream is = null;
      XMLStreamReader parser = null;
  
      String tr = req.getParams().get(CommonParams.TR,null);
      if(tr!=null) {
        Transformer t = getTransformer(tr,req);
        final DOMResult result = new DOMResult();
        
        // first step: read XML and build DOM using Transformer (this is no overhead, as XSL always produces
        // an internal result DOM tree, we just access it directly as input for StAX):
        try {
          is = stream.getStream();
          final InputSource isrc = new InputSource(is);
          isrc.setEncoding(charset);
          final SAXSource source = new SAXSource(isrc);
          t.transform(source, result);
        } catch(TransformerException te) {
          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, te.getMessage(), te);
        } finally {
          IOUtils.closeQuietly(is);
        }
        // second step feed the intermediate DOM tree into StAX parser:
        try {
          parser = inputFactory.createXMLStreamReader(new DOMSource(result.getNode()));
          this.processUpdate(req, processor, parser);
        } catch (XMLStreamException e) {
          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e);
        } finally {
          if (parser != null) parser.close();
        }
      }
      // Normal XML Loader
      else {
        try {
          is = stream.getStream();
          if (UpdateRequestHandler.log.isTraceEnabled()) {
            final byte[] body = IOUtils.toByteArray(is);
            // TODO: The charset may be wrong, as the real charset is later
            // determined by the XML parser, the content-type is only used as a hint!
            UpdateRequestHandler.log.trace("body", new String(body, (charset == null) ?
              ContentStreamBase.DEFAULT_CHARSET : charset));
            IOUtils.closeQuietly(is);
            is = new ByteArrayInputStream(body);
          }
          parser = (charset == null) ?
            inputFactory.createXMLStreamReader(is) : inputFactory.createXMLStreamReader(is, charset);
          this.processUpdate(req, processor, parser);
        } catch (XMLStreamException e) {
          throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e.getMessage(), e);
        } finally {
          if (parser != null) parser.close();
          IOUtils.closeQuietly(is);
        }
      }
    }
    
  
    /** Get Transformer from request context, or from TransformerProvider.
     *  This allows either getContentType(...) or write(...) to instantiate the Transformer,
     *  depending on which one is called first, then the other one reuses the same Transformer
     */
  