code: private char skipObligatoryDtdWs()
          throws XMLStreamException
      {
          /* Ok; since we need at least one space, or a PE, or end of input
           * block, let's do this unique check first...
           */
          int i = peekNext();
          char c;
  
          if (i == -1) { // just means 'local' EOF (since peek only checks current)
              c = getNextChar(getErrorMsg());
              // Non-space, non PE is ok, due to end-of-block...
              if (c > CHAR_SPACE && c != '%') {
                  return c;
              }
          } else {
              c = mInputBuffer[mInputPtr++]; // was peek, need to read
              if (c > CHAR_SPACE && c != '%') {
                  throwDTDUnexpectedChar(c, "; expected a separating white space");
              }
          }
  
          // Ok, got it, now can loop...
          while (true) {
              if (c == '%') {
                  expandPE();
              } else if (c > CHAR_SPACE) {
                  break;
              } else {
                  if (c == '\n' || c == '\r') {
                      skipCRLF(c);
                  } else if (c != CHAR_SPACE && c != '\t') {
                      throwInvalidSpace(c);
                  }
              }
              /* Now we got one space (or end of input block) -- no need to
               * restrict get next on current block (in case PE ends); happens
               * with xmltest/valid/not-sa/003.xml, for eaxmple.
               */
              c = (mInputPtr < mInputEnd)
                  ? mInputBuffer[mInputPtr++] : getNextChar(getErrorMsg());
          }
          return c;
      }
docs: Note: Apparently a parameter entity expansion does also count
  as white space (that is, PEs outside of quoted text are considered
  to be separated by white spaces on both sides). Fortunately this
  can be handled by 2 little hacks: both a start of a PE, and an
  end of input block (== end of PE expansion) count as succesful
  spaces.
  
  @return Character following the obligatory boundary (white space
  or PE start/end)