org.xml.sax.Attributes#getIndex ( )源码实例Demo

下面列出了org.xml.sax.Attributes#getIndex ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk1.8-source-analysis   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码2 项目: TencentKona-8   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码3 项目: jdk8u60   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码4 项目: JDKSourceCode1.8   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码5 项目: openjdk-jdk8u   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码7 项目: Bytecoder   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码8 项目: openjdk-8   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码9 项目: hottub   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码10 项目: openjdk-8-source   文件: SAXImpl.java
/**
 * SAX2: Receive notification of the beginning of an element.
 */
public void startElement(String uri, String localName,
             String qname, Attributes attributes)
    throws SAXException
{
    super.startElement(uri, localName, qname, attributes);

    handleTextEscaping();

    if (m_wsfilter != null) {
        // Look for any xml:space attributes
        // Depending on the implementation of attributes, this
        // might be faster than looping through all attributes. ILENE
        final int index = attributes.getIndex(XMLSPACE_STRING);
        if (index >= 0) {
            xmlSpaceDefine(attributes.getValue(index), m_parents.peek());
        }
    }
}
 
源代码11 项目: openjdk-jdk9   文件: Bug4970951.java
@Test
public void test() throws Exception {
    XMLReader xmlReader = createXMLReader();
    final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
    xmlReader.setContentHandler(validatorHandler);

    DefaultHandler handler = new DefaultHandler() {
        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
            if (!"ns:test".equals(qName)) {
                return;
            }

            TypeInfoProvider infoProvider = validatorHandler.getTypeInfoProvider();
            if (infoProvider == null) {
                throw new SAXException("Can't obtain TypeInfoProvider object.");
            }

            int index = attributes.getIndex("id");
            if (index == -1) {
                throw new SAXException("The attribute 'id' is not in the list.");
            }

            Assert.assertTrue(infoProvider.isSpecified(index));

            index = attributes.getIndex("date");
            if (index == -1) {
                throw new SAXException("The attribute 'date' is not in the list.");
            }

            Assert.assertFalse(infoProvider.isSpecified(index));

            System.out.println("OK");
        }
    };
    validatorHandler.setContentHandler(handler);

    parse(xmlReader, XML);
}
 
源代码12 项目: openjdk-jdk9   文件: TypeInfoProviderTest.java
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
    TypeInfoProvider typeInfoProvider = validatorHandler.getTypeInfoProvider();
    int index = atts.getIndex("orderid");
    if (index != -1) {
        System.out.println(" Index " + index);
        System.out.println(" ElementType " + typeInfoProvider.getElementTypeInfo().getTypeName());
        assertEquals(typeInfoProvider.getAttributeTypeInfo(index).getTypeName(), "string");
        assertTrue(typeInfoProvider.isSpecified(index));
        assertFalse(typeInfoProvider.isIdAttribute(index));
    }

}
 
源代码13 项目: TencentKona-8   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码14 项目: jdk8u60   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码15 项目: openjdk-jdk8u   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码17 项目: openjdk-jdk9   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码18 项目: hottub   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码19 项目: openjdk-8-source   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}
 
源代码20 项目: openjdk-8   文件: XsiTypeLoader.java
static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException {
    UnmarshallingContext context = state.getContext();
    JaxBeanInfo beanInfo = null;

    // look for @xsi:type
    Attributes atts = ea.atts;
    int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");

    if(idx>=0) {
        // we'll consume the value only when it's a recognized value,
        // so don't consume it just yet.
        String value = atts.getValue(idx);

        QName type = DatatypeConverterImpl._parseQName(value,context);
        if(type==null) {
            reportError(Messages.NOT_A_QNAME.format(value),true);
        } else {
            if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type))
                // if this xsi:type is something that the default type can already handle,
                // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195
                // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar,
                // where Date is expected.
                // this is not a complete fix, as we still won't be able to handle simple type substitution in general,
                // but none-the-less
                return defaultBeanInfo;

            beanInfo = context.getJAXBContext().getGlobalType(type);
            if(beanInfo==null) { // let's report an error
                if (context.parent.hasEventHandler() // is somebody listening?
                        && context.shouldErrorBeReported()) { // should we report error?
                    String nearest = context.getJAXBContext().getNearestTypeName(type);
                    if(nearest!=null)
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true);
                    else
                        reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true);
                }
            }
            // TODO: resurrect the following check
    //                    else
    //                    if(!target.isAssignableFrom(actual)) {
    //                        reportError(context,
    //                            Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()),
    //                            true);
    //                        actual = targetBeanInfo;  // ditto
    //                    }
        }
    }
    return beanInfo;
}