code: public static final void checkS(char[] ch, int start, int length) throws NullPointerException, IndexOutOfBoundsException, InvalidXMLException {
  
          // Loop through the array and check each character
          for (int i = start; i < length; i++) {
              int c = ch[i];
  
              if (c != 0x20 && c != 0x9 && c != 0xD && c != 0xA) {
                  throw new InvalidXMLException("The character 0x" + Integer.toHexString(c) + " is not valid for the 'S' production (white space).");
              }
          }
      }
docs: Checks if the specified part of a character array matches the <em>S</em> (white space)
  production. See: <a href="http://www.w3.org/TR/REC-xml#NT-S">Definition of S</a>.
  
  @param ch     the character array that contains the characters to be checked, cannot be
  <code>null</code>.
  @param start  the start index into <code>ch</code>, must be &gt;= 0.
  @param length the number of characters to take from <code>ch</code>, starting at the
  <code>start</code> index.
  @throws NullPointerException      if <code>ch == null</code>.
  @throws IndexOutOfBoundsException if
  <code>start &lt; 0 || start + length &gt; ch.length</code>.
  @throws InvalidXMLException       if the specified character string does not match the <em>S</em>
  production.