Package org.w3c.dom

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


            NodeList ChildNodes = service.getChildNodes();

            Node lastConnectorNode = ChildNodes.item(ChildNodes.getLength() - 1);

            service.insertBefore(connector, lastConnectorNode);
        }
       

        // set attributes for the connector
View Full Code Here


        checkOutElement.appendChild(identityElement);
        checkOutElement.appendChild(timeElement);

        Element root = document.getDocumentElement();
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
        root.insertBefore(checkOutElement, root.getFirstChild());
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());

        setDirty();
View Full Code Here

        checkOutElement.appendChild(identityElement);
        checkOutElement.appendChild(timeElement);

        Element root = document.getDocumentElement();
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
        root.insertBefore(checkOutElement, root.getFirstChild());
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());

        setDirty();

        // If this is a checkout, we write back the changed state
View Full Code Here

        checkOutElement.appendChild(timeElement);

        Element root = document.getDocumentElement();
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());
        root.insertBefore(checkOutElement, root.getFirstChild());
        root.insertBefore(dpf.newTextNode(document, "\n"), root.getFirstChild());

        setDirty();

        // If this is a checkout, we write back the changed state
        // to the file immediately because otherwise another
View Full Code Here

            Element backupElement = helper.createElement(ELEMENT_BACKUP);
            checkOutElement.appendChild(backupElement);
        }

        Element root = this.document.getDocumentElement();
        root.insertBefore(checkOutElement, root.getFirstChild());

        setDirty();

        // If this is a checkout, we write back the changed state
        // to the file immediately because otherwise another
View Full Code Here

                metaElement = namespaceHelper.createElement(META_ROOT);
                Element[] children = DocumentHelper.getChildren(documentElement);
                if (children.length == 0) {
                    documentElement.appendChild(metaElement);
                } else {
                    documentElement.insertBefore(metaElement, children[0]);
                }
            }
        } catch (final Exception e) {
            throw new DocumentException(e);
        }
View Full Code Here

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

                    if (text != null && _currentNode != _doc)
                        e.insertBefore( _doc.createTextNode( text ), null );
                }
                else
                {
                    _currentNode = e;
                }
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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        Document document = (Document)OMXMLBuilderFactory.createOMBuilder(factory, new StringReader("<root><a/><b/></root>")).getDocument();
        Element parent = document.getDocumentElement();
        parent.insertBefore(document.createElementNS(null, "c"), null);
        NodeList children = parent.getChildNodes();
        assertEquals(3, children.getLength());
        assertEquals("a", children.item(0).getLocalName());
        assertEquals("b", children.item(1).getLocalName());
        assertEquals("c", children.item(2).getLocalName());
View Full Code Here

   
            if (headerComment != null)
            {
                Element root = _doc.getDocumentElement();
                Comment comment = _doc.createComment(headerComment);
                root.insertBefore(comment, root.getFirstChild());
            }
        }
        catch (ParserConfigurationException e)
        {
            throw new XmlModelWriterException(e);
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.