当前位置: 首页>>代码示例>>Java>>正文


Java DatatypeConverterImpl._parseQName方法代码示例

本文整理汇总了Java中com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName方法的典型用法代码示例。如果您正苦于以下问题:Java DatatypeConverterImpl._parseQName方法的具体用法?Java DatatypeConverterImpl._parseQName怎么用?Java DatatypeConverterImpl._parseQName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.xml.internal.bind.DatatypeConverterImpl的用法示例。


在下文中一共展示了DatatypeConverterImpl._parseQName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import com.sun.xml.internal.bind.DatatypeConverterImpl; //导入方法依赖的package包/类
public QName parse(CharSequence text) throws SAXException {
    try {
        return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance());
    } catch (IllegalArgumentException e) {
        UnmarshallingContext.getInstance().handleError(e);
        return null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:RuntimeBuiltinLeafInfoImpl.java

示例2: parseXsiType

import com.sun.xml.internal.bind.DatatypeConverterImpl; //导入方法依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:50,代码来源:XsiTypeLoader.java


注:本文中的com.sun.xml.internal.bind.DatatypeConverterImpl._parseQName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。