Java Code Examples for com.sun.xml.internal.bind.DatatypeConverterImpl#_parseQName

The following examples show how to use com.sun.xml.internal.bind.DatatypeConverterImpl#_parseQName . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RuntimeBuiltinLeafInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 2
Source File: RuntimeBuiltinLeafInfoImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 3
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 4
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 5
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 6
Source File: RuntimeBuiltinLeafInfoImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 7
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 8
Source File: RuntimeBuiltinLeafInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
Example 9
Source File: XsiTypeLoader.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 10
Source File: XsiTypeLoader.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 11
Source File: XsiTypeLoader.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 12
Source File: XsiTypeLoader.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 13
Source File: XsiTypeLoader.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 14
Source File: XsiTypeLoader.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 15
Source File: XsiTypeLoader.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
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;
}
 
Example 16
Source File: XsiTypeLoader.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
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;
}