Java Code Examples for org.apache.cxf.helpers.domutils#convertStringToQName()

The following examples show how to use org.apache.cxf.helpers.domutils#convertStringToQName() . 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: WadlGenerator.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Override
public QName resolve(Class<?> type, Annotation[] annotations, Map<Class<?>, QName> clsMap) {
    XMLName name = AnnotationUtils.getAnnotation(annotations, XMLName.class);
    if (name == null) {
        name = type.getAnnotation(XMLName.class);
    }
    if (name != null) {
        QName qname = DOMUtils.convertStringToQName(name.value(), name.prefix());
        if (qname.getPrefix().length() > 0) {
            return qname;
        }
        return getQNameFromParts(qname.getLocalPart(), qname.getNamespaceURI(), type, clsMap);
    }
    return null;
}
 
Example 2
Source File: TransformUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected static void convertToQNamesMap(Map<String, String> map,
                                         QNamesMap elementsMap,
                                         Map<String, String> nsMap) {
    if (map != null) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            QName lname = DOMUtils.convertStringToQName(entry.getKey());
            QName rname = DOMUtils.convertStringToQName(entry.getValue());
            elementsMap.put(lname, rname);
            if (nsMap != null && !isEmptyQName(rname)
                && ("*".equals(lname.getLocalPart()) && "*".equals(rname.getLocalPart()))) {
                nsMap.put(lname.getNamespaceURI(), rname.getNamespaceURI());
            }
        }
    }
}
 
Example 3
Source File: TransformUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
static void convertToMapOfElementProperties(Map<String, String> map,
                                            Map<QName, ElementProperty> elementsMap) {
    if (map != null) {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            String text = null;
            boolean child = false;

            // if the content delimiter is present in the value, extract the content
            int d = value.indexOf('}');
            d = value.indexOf('=', d < 0 ? 0 : d);
            if (d > 0) {
                text = value.substring(d + 1);
                value = value.substring(0, d);
            }

            // if the trailer delimiter is present in the key, remove it
            if (key.endsWith("/")) {
                key = key.substring(0, key.length() - 1);
                child = true;
            }
            QName lname = DOMUtils.convertStringToQName(key);
            QName rname = DOMUtils.convertStringToQName(value);

            ElementProperty desc = new ElementProperty(rname, text, child);
            elementsMap.put(lname, desc);
        }
    }
}
 
Example 4
Source File: TransformUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected static void convertToSetOfQNames(List<String> set,
                                           Set<QName> elementsSet) {
    if (set != null) {
        for (String entry : set) {
            QName name = DOMUtils.convertStringToQName(entry);
            elementsSet.add(name);
        }
    }
}
 
Example 5
Source File: JAXRSUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static QName convertStringToQName(String name) {
    return DOMUtils.convertStringToQName(name, "");
}