code: private void readPI()
          throws XMLStreamException
      {
          int ptr = mInputPtr;
          int start = ptr;
          char[] inputBuf = mInputBuffer;
          int inputLen = mInputEnd;
  
          outer_loop:
          while (ptr < inputLen) {
              char c = inputBuf[ptr++];
              if (c < CHAR_SPACE) {
                  if (c == '\n') {
                      markLF(ptr);
                  } else if (c == '\r') {
                      if (ptr < inputLen && !mNormalizeLFs) {
                          if (inputBuf[ptr] == '\n') {
                              ++ptr;
                          }
                          markLF(ptr);
                      } else {
                          --ptr; // pushback
                          break;
                      }
                  } else if (c != '\t') {
                      throwInvalidSpace(c);
                  }
              } else if (c == '?') {
                  // K; now just need '>' after zero or more '?'s
                  while (true) {
                      if (ptr >= inputLen) {
                          /* end of buffer; need to push back at least one of
                           * question marks (not all, since just one is needed
                           * to close the PI)
                           */
                          --ptr;
                          break outer_loop;
                      }
                      c = inputBuf[ptr++];
                      if (c == '>') {
                          mInputPtr = ptr;
                          // Need to discard trailing '?>'
                          mTextBuffer.resetWithShared(inputBuf, start, ptr-start-2);
                          return;
                      }
                      if (c != '?') {
                          // Not end, can continue, but need to push back last char, in case it's LF/CR
                          --ptr;
                          break;
                      }
                  }
              }
          }
          
          mInputPtr = ptr;
          // No point in trying to share... let's just append
          mTextBuffer.resetWithCopy(inputBuf, start, ptr-start);
          readPI2(mTextBuffer);
      }
docs: Method that parses a processing instruction's data portion; at this
  point target has been parsed.