code: public static Document getDocument(InputStream inputStream) {
          Document result = null;
  
          try {
              // memory optimization over minor performance sacrifice
              synchronized (XmlRepositoryFactory.class) {
                  if (documentBuilder == null) {
                      documentBuilder = builderFactory.newDocumentBuilder();
                  }
  
                  result = documentBuilder.parse(inputStream);
              }
          } catch (ParserConfigurationException ex) {
              throw new MjdbcRuntimeException(ex);
          } catch (SAXException ex) {
              throw new MjdbcRuntimeException(ex);
          } catch (IOException ex) {
              throw new MjdbcRuntimeException(ex);
          }
  
          return result;
      }
docs: Reads XML stream and returns it is DOM XML Document instance.
  Can be used in conjunction with {@link #addAll(org.w3c.dom.Document)}
  
  @param inputStream stream which should be read
  @return {@link Document} instance