code: private Reader getPushBackReader(Reader source) throws ParseException
      {
          PushbackReader pushbackReader = new PushbackReader(source);
          int c;
          try {
              c = pushbackReader.read();
              if (c == -1) {
                  return null;
              }
              pushbackReader.unread(c);
          } catch (IOException e) {
              throw new ParseException("Failed to find out if the source to parse is empty or not", e);
          }
          return  pushbackReader;
      }
docs: In order to handle empty content we use a {@link PushbackReader} to try to read one character from the stream
  and if we get -1 it means that the stream is empty and in this case we return an empty XDOM.