List of usage examples for javax.xml.soap SOAPElement removeAttribute
public boolean removeAttribute(QName qname);
From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java
@Validated @Test/* w ww .j a va 2 s .com*/ public void testRemoveAttributeByQNameNonExisting() throws Exception { SOAPElement element = saajUtil.createSOAPElement(null, "test", null); element.setAttributeNS("urn:ns1", "ns1:attr", "value"); assertFalse(element.removeAttribute(new QName("urn:ns2", "test"))); NamedNodeMap attributes = element.getAttributes(); assertEquals(1, attributes.getLength()); }
From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java
/** * Tests the behavior of {@link SOAPElement#removeAttribute(QName)} for an attribute created * with {@link Element#setAttribute(String, String)}. * /*from w w w . j a va 2 s . com*/ * @throws Exception */ @Validated @Test public void testRemoveAttributeByQNameWithoutNamespace2() throws Exception { SOAPElement element = saajUtil.createSOAPElement(null, "test", null); element.setAttributeNS("urn:ns1", "ns1:attr", "value"); element.setAttribute("attr", "value"); assertTrue(element.removeAttribute(new QName("attr"))); NamedNodeMap attributes = element.getAttributes(); assertEquals(1, attributes.getLength()); }
From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java
/** * Tests the behavior of {@link SOAPElement#removeAttribute(QName)} for an attribute created * with {@link Element#setAttributeNS(String, String, String)}, but without namespace. * /*from w w w .j av a 2s .c o m*/ * @throws Exception */ @Validated @Test public void testRemoveAttributeByQNameWithoutNamespace1() throws Exception { SOAPElement element = saajUtil.createSOAPElement(null, "test", null); element.setAttributeNS("urn:ns1", "ns1:attr", "value"); element.setAttributeNS(null, "attr", "value"); assertTrue(element.removeAttribute(new QName("attr"))); NamedNodeMap attributes = element.getAttributes(); assertEquals(1, attributes.getLength()); }
From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java
@Validated @Test//from w w w . java 2 s . c o m public void testRemoveAttributeByQNameWithNamespace() throws Exception { SOAPElement element = saajUtil.createSOAPElement(null, "test", null); element.setAttributeNS("urn:ns1", "ns1:attr", "value"); element.setAttributeNS("urn:ns2", "ns2:attr", "value"); assertTrue(element.removeAttribute(new QName("urn:ns1", "attr"))); NamedNodeMap attributes = element.getAttributes(); assertEquals(1, attributes.getLength()); }
From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java
@Validated @Test/* www .j a va 2 s .co m*/ public void testRemoveAttributeByName() throws Exception { SOAPEnvelope envelope = saajUtil.createSOAP11Envelope(); SOAPBody body = envelope.addBody(); SOAPElement element = body.addChildElement(new QName("urn:test", "test")); element.setAttributeNS("urn:ns1", "ns1:attr1", "value"); element.setAttributeNS("urn:ns1", "ns1:attr2", "value"); assertTrue(element.removeAttribute(envelope.createName("attr2", "p", "urn:ns1"))); NamedNodeMap attributes = element.getAttributes(); assertNull(attributes.getNamedItemNS("urn:ns1", "attr2")); }
From source file:org.jbpm.bpel.integration.soap.SoapUtil.java
public static void removeAttributes(SOAPElement elem) { if (elem.hasAttributes()) { Iterator attrNameIt = elem.getAllAttributes(); while (attrNameIt.hasNext()) { Name attrName = (Name) attrNameIt.next(); elem.removeAttribute(attrName); }/*from w w w . java 2s. com*/ } }