List of usage examples for javax.xml.namespace QName getLocalPart
public String getLocalPart()
Get the local part of this QName
.
From source file:com.bradmcevoy.property.BeanPropertySource.java
@Override public void setProperty(QName name, Object value, Resource r) throws NotAuthorizedException, PropertySetException { log.debug("setProperty: " + name + " = " + value); PropertyDescriptor pd = getPropertyDescriptor(r, name.getLocalPart()); try {//w w w . j a va 2 s. co m pd.getWriteMethod().invoke(r, value); } catch (PropertySetException e) { throw e; } catch (Exception ex) { if (ex.getCause() instanceof NotAuthorizedException) { NotAuthorizedException na = (NotAuthorizedException) ex.getCause(); throw na; } else if (ex.getCause() instanceof PropertySetException) { PropertySetException na = (PropertySetException) ex.getCause(); throw na; } else { if (value == null) { log.error("Exception setting property: " + name.toString() + " to null"); } else { log.error("Exception setting property: " + name.toString() + " to value: " + value + " class:" + value.getClass()); } throw new RuntimeException(name.toString(), ex); } } }
From source file:com.evolveum.midpoint.util.DOMUtil.java
public static QName getQNameWithoutPrefix(Node node) { QName qname = getQName(node); return new QName(qname.getNamespaceURI(), qname.getLocalPart()); }
From source file:com.evolveum.midpoint.util.DOMUtil.java
public static String getAttribute(Element element, QName attrQname) { String attr = element.getAttributeNS(attrQname.getNamespaceURI(), attrQname.getLocalPart()); if (StringUtils.isEmpty(attr)) { // also try without the namespace attr = element.getAttribute(attrQname.getLocalPart()); }//ww w . ja va 2 s . com return attr; }
From source file:com.revolsys.record.io.format.xml.XmlProcessor.java
/** * Get the method to process the XML element. * * @param element The element to process. * @return The method to process the XML element. *///from w w w. ja va 2 s. c o m private Method getProcessMethod(final QName element) { final String elementName = element.getLocalPart(); final Method method = this.methodCache.get(elementName); return method; }
From source file:com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper.java
@Override public QName setQNamePrefix(QName qname) { String namespace = qname.getNamespaceURI(); String prefix = getPrefix(namespace); if (prefix == null) { return qname; }//www .j a v a 2s . c o m return new QName(qname.getNamespaceURI(), qname.getLocalPart(), prefix); }
From source file:org.pentaho.di.trans.steps.webservices.wsdl.Wsdl.java
/** * Change the port of the service.//from w w w .j a v a 2 s. c o m * * @param portName * The new port name. * @throws IllegalArgumentException * if port name is not defined in WSDL. */ public void setPort(QName portName) { Port port = _service.getPort(portName.getLocalPart()); if (port == null) { throw new IllegalArgumentException("Port name: '" + portName + "' was not found in the WSDL file."); } _port = port; _operationCache.clear(); }
From source file:com.evolveum.midpoint.util.DOMUtil.java
public static QName getQNameAttribute(Element element, QName attributeName) { String attrContent = element.getAttributeNS(attributeName.getNamespaceURI(), attributeName.getLocalPart()); if (StringUtils.isBlank(attrContent)) { return null; }//w ww. ja v a2 s . c o m return resolveQName(element, attrContent); }
From source file:net.bpelunit.util.XMLUtilTest.java
@Test public void testResolveQName_DefaultNamespace() throws Exception { Document xml = XMLUtil.parseXML("<a xmlns=\"ns1\">b</a>"); QName qname = XMLUtil.resolveQName("a", xml.getDocumentElement()); assertEquals("ns1", qname.getNamespaceURI()); assertEquals("a", qname.getLocalPart()); }
From source file:net.bpelunit.util.XMLUtilTest.java
@Test public void testResolveQName_NormalPrefix() throws Exception { Document xml = XMLUtil.parseXML("<ns:a xmlns:ns=\"ns1\">ns:b</ns:a>"); QName qname = XMLUtil.resolveQName("ns:a", xml.getDocumentElement()); assertEquals("ns1", qname.getNamespaceURI()); assertEquals("a", qname.getLocalPart()); }
From source file:com.evolveum.midpoint.prism.xml.GlobalDynamicNamespacePrefixMapper.java
@Override public QName setQNamePrefixExplicit(QName qname) { String namespace = qname.getNamespaceURI(); String prefix = getPrefixExplicit(namespace); if (prefix == null) { return qname; }//from w w w . j a v a 2 s .co m return new QName(qname.getNamespaceURI(), qname.getLocalPart(), prefix); }