public static int getSimpleTypeIndex(XmlElement element) { XmlAttribute type = element.attribute(STR_TYPE); if (null == type) { return -1; } String typeQNameString = type.getValue(); String typeName = XMLUtil.getLocalPartOfQName(typeQNameString); String prefix = XMLUtil.getPrefixOfQName(typeQNameString); XmlNamespace namespace = element.lookupNamespaceByPrefix(prefix); if (namespace == null) { return -1; } QName typeQname = new QName(namespace.getName(), typeName, prefix); int simpleTypeIndex = getSimpleTypeIndex(typeQname); if (-1 == simpleTypeIndex) { return -1; } XmlAttribute maxOccurs = element.attribute(STR_MAX_OCCURS); if (maxOccurs != null && STR_UNBOUNDED.equals(maxOccurs.getValue())) { // this is the comvention the arraytype index is simplextye index + NUM return NUM + simpleTypeIndex; } else { return simpleTypeIndex; } }