code: private final int readPIPrimary()
          throws XMLStreamException
      {
          // Ok, first we need the name:
          String target = parseFullName();
          mCurrName = target;
  
          if (target.length() == 0) {
              throwParseError(ErrorConsts.ERR_WF_PI_MISSING_TARGET);
          }
  
          // As per XML specs, #17, case-insensitive 'xml' is illegal:
          if (target.equalsIgnoreCase("xml")) {
              // 07-Oct-2005, TSa: Still legal in multi-doc mode...
              if (!mConfig.inputParsingModeDocuments()) {
                  throwParseError(ErrorConsts.ERR_WF_PI_XML_TARGET, target, null);
              }
              // Ok, let's just verify we get space then
              char c = getNextCharFromCurrent(SUFFIX_IN_XML_DECL);
              if (!isSpaceChar(c)) {
                  throwUnexpectedChar(c, "excepted a space in xml declaration after 'xml'");
              }
              return handleMultiDocStart(START_DOCUMENT);
          }
  
          // And then either white space before data, or end marker:
          char c = (mInputPtr < mInputEnd) ?
              mInputBuffer[mInputPtr++] : getNextCharFromCurrent(SUFFIX_IN_PROC_INSTR);
          if (isSpaceChar(c)) { // Ok, space to skip
              mTokenState = TOKEN_STARTED;
              // Need to skip the WS...
              skipWS(c);
          } else { // Nope; apparently finishes right away...
              mTokenState = TOKEN_FULL_COALESCED;
              mTextBuffer.resetWithEmpty();
              // or does it?
              if (c != '?' || getNextCharFromCurrent(SUFFIX_IN_PROC_INSTR) != '>') {
                  throwUnexpectedChar(c, ErrorConsts.ERR_WF_PI_XML_MISSING_SPACE);
              }
          }
  
          return PROCESSING_INSTRUCTION;
      }
docs: Method that reads the primary part of a PI, ie. target, and also
  skips white space between target and data (if any data)
  
  @return Usually <code>PROCESSING_INSTRUCTION</code>; but may be
  different in multi-doc mode, if we actually hit a secondary
  xml declaration.