Package org.w3c.dom

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


        Node parent = textNode.getParentNode();
        parent.insertBefore(getModel().getDocument().createTextNode(
            before), textNode);
        Element bnode = createStyleElement();
        bnode.appendChild(middleText);
        parent.insertBefore(bnode, textNode);
      }
      textNode.setNodeValue(tail);
    }

    if (!isEmptyString(before) && isEmptyString(tail)) {
View Full Code Here


    if (!isEmptyString(before) && isEmptyString(tail)) {
      Node sibling = textNode.getNextSibling();
      textNode.setNodeValue(before);
      if (sibling != null
          && sibling.getNodeName().equalsIgnoreCase(getTag())) {
        sibling.insertBefore(middleText, sibling.getFirstChild());
      } else {
        Element bnode = createStyleElement();
        bnode.appendChild(middleText);
        textNode.getParentNode().insertBefore(bnode, sibling);
      }
View Full Code Here

            && previousSibling.getNodeName().equalsIgnoreCase(
                getTag())) {
          previousSibling.appendChild(middleText);
        } else if (nextSibling != null
            && nextSibling.getNodeName().equalsIgnoreCase(getTag())) {
          nextSibling.insertBefore(middleText, nextSibling
              .getFirstChild());
        } else {
          Element bnode = createStyleElement();
          bnode.appendChild(middleText);
          textNode.getParentNode().insertBefore(bnode, textNode);
View Full Code Here

      return;
    Document document = node.getOwnerDocument();
    if (document == null)
      return;
    Text text = document.createTextNode(delim);
    parent.insertBefore(text, node);
  }

  /**
   */
  private IDOMModel readModel(InputStream input) throws IOException, UnsupportedEncodingException {
View Full Code Here

        if (docType != null) {
          if (!name.equals(docType.getName())) { // replace
            Node parent = docType.getParentNode();
            child = docType;
            docType = (IDOMDocumentType) document.createDoctype(name);
            parent.insertBefore(docType, child);
            parent.removeChild(child);
          }
        }
        else {
          docType = (IDOMDocumentType) document.createDoctype(name);
View Full Code Here

    logbase.appendChild(rootExponent.toNode());
    ASTNodeValue v = createApplyNode("root", radiant);
    Node v_node = v.toNode();
   
    // TODO : Not working - not correcting it as the mathMl output is wrong anyway and will be re-implemented.
    v_node.insertBefore(logbase, v_node.getFirstChild().getNextSibling());
   
    return v;
  }

  /* (non-Javadoc)
 
View Full Code Here

        if (last != document) {
            final String text = new String(ch, start, length);
            if (lastSibling != null && lastSibling.getNodeType() == Node.TEXT_NODE) {
                ((Text)lastSibling).appendData(text);
            } else if (last == root && nextSibling != null) {
                lastSibling = last.insertBefore(document.createTextNode(text), nextSibling);
            } else {
                lastSibling = last.appendChild(document.createTextNode(text));
            }

        }
View Full Code Here

        Node last = nodeStk.peek();

        // If the SAX2DOM is created with a non-null next sibling node,
        // insert the result nodes before the next sibling under the root.
        if (last == root && nextSibling != null) {
            last.insertBefore(tmp, nextSibling);
        } else {
            last.appendChild(tmp);
        }

        // Push this node onto stack
View Full Code Here

    public void processingInstruction(String target, String data) {
        final Node last = nodeStk.peek();
        ProcessingInstruction pi = document.createProcessingInstruction(target, data);
        if (pi != null) {
            if (last == root && nextSibling != null) {
                last.insertBefore(pi, nextSibling);
            } else {
                last.appendChild(pi);
            }

            lastSibling = pi;
View Full Code Here

    public void comment(char[] ch, int start, int length) {
        final Node last = nodeStk.peek();
        Comment comment = document.createComment(new String(ch, start, length));
        if (comment != null) {
            if (last == root && nextSibling != null) {
                last.insertBefore(comment, nextSibling);
            } else {
                last.appendChild(comment);
            }

            lastSibling = comment;
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.