Package org.w3c.dom

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


          if( header.length == 0 )
          {
            Element docElm = ( ( Document )dest.getDomNode() ).getDocumentElement();

            destElm = ( Element )docElm.insertBefore(
                docElm.getOwnerDocument().createElementNS( soapVersion.getEnvelopeNamespace(),
                    docElm.getPrefix() + ":Header" ),
                XmlUtils.getFirstChildElementNS( docElm, soapVersion.getBodyQName() ) );
          }
          else
View Full Code Here


                            r._text.fetch(
                                c.getCpForPos( r, 1 ), c.getCchValue() );
                    }

                    if (text != null)
                        e.insertBefore( _doc.createTextNode( text ), null );
                }
                else
                {
                    _currentNode = e;
                }
View Full Code Here

        DocumentBuilder builder = XMLUtils.createDocumentBuilder(false);
        Document document = builder.parse(file);

        XMLSignature sig = new XMLSignature(document, "", "http://www.w3.org/2000/09/xmldsig#rsa-sha1");
        Element root = document.getDocumentElement();
        root.insertBefore(sig.getElement(), root.getFirstChild());

        Transforms transforms = new Transforms(document);
        transforms.addTransform(Transforms.TRANSFORM_ENVELOPED_SIGNATURE);
        transforms.addTransform(Transforms.TRANSFORM_C14N_OMIT_COMMENTS);
        sig.addDocument("", transforms, "http://www.w3.org/2000/09/xmldsig#sha1");
View Full Code Here

        Element newReferenceElement = (Element) xPathExpression.evaluate(clonedEncryptedElement, XPathConstants.NODE);
        newReferenceElement.removeAttribute("URI");
        newReferenceElement.setAttributeNS(null, "URI", "#G2");

        Element securityHeaderNode = (Element) encryptedKeyElement.getParentNode();
        securityHeaderNode.insertBefore(clonedEncryptedElement, encryptedKeyElement);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

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

      } // end while
      // Either insert at the end or before the next element
      if ( sibling == null ) {
        parent.appendChild( initializer );
      } else {
        parent.insertBefore( initializer, sibling );
      } // end if
     
    } // end insertSCAPropertyInitializer
   
    /**
 
View Full Code Here

          // find head
          org.w3c.dom.Node head = nodeVisitor.head;
          // Insert empty if not found
          if (null == head) {
            head = document.createElement("head");
            documentElement.insertBefore(head, documentElement
                .getFirstChild());
          }
          org.w3c.dom.Node child = head.getFirstChild();
          while (child != null) {
            if (child instanceof Element) {
View Full Code Here

            Element clonedElmt = (Element) parentElmt.cloneNode(true);
            children = clonedElmt.getChildNodes();
            Node refChild = (position < children.getLength()) ? children.item(position) : null;
            Document clonedDocument = clonedElmt.getOwnerDocument();
            for (int i = 0; i < siblingNodes.size(); i++) {
              clonedElmt.insertBefore(clonedDocument.importNode((Node) siblingNodes.get(i), true), refChild);
            }
            return clonedElmt;
      }
    }
   
View Full Code Here

            Element clonedElmt = (Element) parentElmt.cloneNode(true);
            children = clonedElmt.getChildNodes();
            Node refChild = (position <= children.getLength()) ? children.item(position - 1) : null;
            Document clonedDocument = clonedElmt.getOwnerDocument();
            for (int i = 0; i < siblingNodes.size(); i++) {
              clonedElmt.insertBefore(clonedDocument.importNode((Node) siblingNodes.get(i), true), refChild);
            }
            return clonedElmt;
      }
    }
View Full Code Here

            }
            Element clonedElmt = (Element) targetElmt.cloneNode(true);
            Node refChild = clonedElmt.getFirstChild();
            Document clonedDocument = clonedElmt.getOwnerDocument();
            for (int i = 0; i < siblingNodes.size(); i++) {
              clonedElmt.insertBefore(clonedDocument.importNode((Node) siblingNodes.get(i), true), refChild);
            }
            return clonedElmt;
      }
    }
View Full Code Here

              refChild = null;
            } else {
              refChild = children.item(position + 1);
            }
            for (int i = 0; i < childNodes.size(); i++) {
              clonedElmt.insertBefore((Node) childNodes.get(i), refChild);
            }
            return clonedElmt;
      }
    }
   
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.