code: public static boolean parseBoolean(String lexicalXSDBoolean) {
          final boolean result;
          switch (lexicalXSDBoolean) {
              case "true":
              case "1":
                  result = true;
                  break;
              case "false":
              case "0":
                  result = false;
                  break;
              default:
                  throw new IllegalArgumentException("'" + lexicalXSDBoolean + "' is not a valid xs:boolean value");
          }
          return result;
      }
docs: Converts an attribute value representing an xsd:boolean value to a
  boolean using the rules as stated in the XML specification.
  
  @param lexicalXSDBoolean The string-value of the boolean
  @return the boolean value represented by {@code lexicalXSDBoolean}
  @throws java.lang.IllegalArgumentException When {@code lexicalXSDBoolean} does fit
  the lexical space of the XSD boolean datatype