Package org.w3c.dom

Examples of org.w3c.dom.Element.removeChild()


            }

            // Remove all but the first Text node
            for (org.w3c.dom.Node tn : textNodes)
            {
                elem.removeChild(tn);
            }
            return result;
        }
    }
View Full Code Here


        encryptedKeyElement.setAttributeNS(null, "Id", "G2");

        xPathExpression = getXPath(".//dsig:X509Data");
        Element keyIdentifierElement = (Element) xPathExpression.evaluate(encryptedKeyElement, XPathConstants.NODE);
        Element securityTokenReferenceElement = (Element) keyIdentifierElement.getParentNode();
        securityTokenReferenceElement.removeChild(keyIdentifierElement);
        //wsse:Reference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" URI="#EncKeyId-1483925398"/>
        Element referenceElement = securedDocument.createElementNS(WSSConstants.TAG_wsse_Reference.getNamespaceURI(), WSSConstants.TAG_wsse_Reference.getLocalPart());
        referenceElement.setAttributeNS(null, "URI", "#G1");
        securityTokenReferenceElement.appendChild(referenceElement);
View Full Code Here

    }

    // Try with no info element
    try {
      Element bad = buildPost(doc, 2, "inf", "msg", "user");
      bad.removeChild(bad.getElementsByTagName("info").item(0));
      Post post = new Post(bad);
      assertEquals(2, post.getId());
      assertEquals("", post.getInfo());
      assertEquals("msg", post.getMessage());
      assertEquals("user", post.getLogin());
View Full Code Here

    }

    // Try with no message element
    try {
      Element bad = buildPost(doc, 3, "inf", "msg", "user");
      bad.removeChild(bad.getElementsByTagName("message").item(0));
      Post post = new Post(bad);
      assertEquals(3, post.getId());
      assertEquals("inf", post.getInfo());
      assertEquals("", post.getMessage());
      assertEquals("user", post.getLogin());
View Full Code Here

    }

    // Try with no login element
    try {
      Element bad = buildPost(doc, 2, "inf", "msg", "user");
      bad.removeChild(bad.getElementsByTagName("login").item(0));
      Post post = new Post(bad);
      assertEquals(2, post.getId());
      assertEquals("inf", post.getInfo());
      assertEquals("msg", post.getMessage());
      assertEquals(Post.ANONYMOUS_LOGIN, post.getLogin());
View Full Code Here

          }
        }
            }
            if(inverse) {
        for(j = childCount-2; j>=0; j--) {
          child = element.removeChild(childs.item(j));
          element.appendChild(child);
        }
            }
          }
      }
View Full Code Here

            WSEncryptionPart encP = new WSEncryptionPart("definitions", "http://schemas.xmlsoap.org/wsdl/", "Element");
            List<WSEncryptionPart> encryptionParts = new ArrayList<WSEncryptionPart>();
            encryptionParts.add(encP);
            Element ref = builder.encryptForRef(null, encryptionParts);
            ref.removeChild(ref.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "DataReference").item(0));
            builder.addExternalRefElement(ref, secHeader);
            builder.prependToHeader(secHeader);

            javax.xml.transform.Transformer transformer = TRANSFORMER_FACTORY.newTransformer();
            transformer.transform(new DOMSource(doc), new StreamResult(baos));
View Full Code Here

      }
      document.appendChild(math);
    } else {
      math = document.getDocumentElement();
      for (int i = math.getChildNodes().getLength() - 1; i >= 0; i--) {
        math.removeChild(math.getChildNodes().item(i));
      }
    }
    math.appendChild(node);
    return document;
  }
View Full Code Here

        Element fragElt = (Element) _contextDocument.importNode(
             d.getDocumentElement(), true);
        result = _contextDocument.createDocumentFragment();
        Node child = fragElt.getFirstChild();
        while (child != null) {
          fragElt.removeChild(child);
          result.appendChild(child);
          child = fragElt.getFirstChild();
        }
        // String outp = serialize(d);
View Full Code Here

        Element fragElt = (Element) _contextDocument.importNode(
             d.getDocumentElement(), true);
        result = _contextDocument.createDocumentFragment();
        Node child = fragElt.getFirstChild();
        while (child != null) {
          fragElt.removeChild(child);
          result.appendChild(child);
          child = fragElt.getFirstChild();
        }
        // String outp = serialize(d);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.