code: private <T> T read(final Class<T> rootType) throws Exception {
          StartElement start = advanceToStartElement();
          if (start.getName().equals(BEAN_QNAME) == false) {
              throw new IllegalArgumentException("Expected root element 'bean' but found '" + start.getName() + "'");
          }
          Attribute attr = start.getAttributeByName(TYPE_QNAME);
          if (attr == null && rootType == Bean.class) {
              throw new IllegalArgumentException("Root element attribute must specify '" + TYPE + "'");
          }
          Class<?> effectiveType = rootType;
          if (attr != null) {
              String typeStr = attr.getValue();
              effectiveType = SerTypeMapper.decodeType(typeStr, settings, null, knownTypes);
              if (rootType.isAssignableFrom(effectiveType) == false) {
                  throw new IllegalArgumentException("Specified root type is incompatible with XML root type: " + rootType.getName() + " and " + effectiveType.getName());
              }
          }
          if (Bean.class.isAssignableFrom(effectiveType) == false) {
              throw new IllegalArgumentException("Root type is not a Joda-Bean: " + effectiveType.getName());
          }
          basePackage = effectiveType.getPackage().getName() + ".";
          Object parsed = parseBean(effectiveType);
          return rootType.cast(parsed);
      }
docs: Parses the root bean.
  
  @param rootType  the root type, not null
  @return the bean, not null
  @throws Exception if an error occurs