Java Code Examples for org.apache.cxf.helpers.DOMUtils#getNamespace()
The following examples show how to use
org.apache.cxf.helpers.DOMUtils#getNamespace() .
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: NamespaceHelper.java From cxf with Apache License 2.0 | 6 votes |
public static QName createQName(Element e, String value, String defaultNamespace) { if (value == null) { return null; } int index = value.indexOf(':'); if (index == -1) { return new QName(defaultNamespace, value); } String prefix = value.substring(0, index); String localName = value.substring(index + 1); String jNS = DOMUtils.getNamespace(e, prefix); if (jNS == null) { throw new DatabindingException("No namespace was found for prefix: " + prefix); } if (localName == null) { throw new DatabindingException("Invalid QName in mapping: " + value); } return new QName(jNS, localName, prefix); }
Example 2
Source File: XMLTypeCreator.java From cxf with Apache License 2.0 | 6 votes |
/** * Creates a QName from a string, such as "ns:Element". */ protected QName createQName(Element e, String value) { if (value == null || value.length() == 0) { return null; } int index = value.indexOf(':'); if (index == -1) { return new QName(getTypeMapping().getMappingIdentifierURI(), value); } String prefix = value.substring(0, index); String localName = value.substring(index + 1); String ns = DOMUtils.getNamespace(e, prefix); if (ns == null || localName == null) { throw new DatabindingException("Invalid QName in mapping: " + value); } return new QName(ns, localName, prefix); }
Example 3
Source File: AbstractBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
protected QName parseQName(Element element, String t) { if (t.startsWith("{")) { int i = t.indexOf('}'); if (i == -1) { throw new RuntimeException("Namespace bracket '{' must having a closing bracket '}'."); } t = t.substring(i + 1); } final String local; final String pre; final String ns; int colIdx = t.indexOf(':'); if (colIdx == -1) { local = t; pre = ""; ns = DOMUtils.getNamespace(element, ""); } else { pre = t.substring(0, colIdx); local = t.substring(colIdx + 1); ns = DOMUtils.getNamespace(element, pre); } return new QName(ns, local, pre); }
Example 4
Source File: AbstractBPBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
public QName parseQName(Element element, String t) { String t1 = t; if (t1.startsWith("{")) { int i = t1.indexOf('}'); if (i == -1) { throw new RuntimeException("Namespace bracket '{' must having a closing bracket '}'."); } t1 = t1.substring(i + 1); } final String local; final String pre; final String ns; int colIdx = t1.indexOf(':'); if (colIdx == -1) { local = t1; pre = ""; ns = DOMUtils.getNamespace(element, ""); } else { pre = t1.substring(0, colIdx); local = t1.substring(colIdx + 1); ns = DOMUtils.getNamespace(element, pre); } return new QName(ns, local, pre); }