Package nu.xom

Examples of nu.xom.Document.indexOf()


    protected void write(ProcessingInstruction instruction)
      throws IOException {
        String parent = (String) parents.peek();
        if (parent.equals("doc")) {
            Document doc = instruction.getDocument();
            int root = doc.indexOf(instruction);
            writeRaw(parent + ".insertChild(new ProcessingInstruction(\"" + instruction.getTarget()
                + "\", \"" + escapeText(instruction.getValue()) + "\"), " + root + ");");           
        }
        else {
            writeRaw(parent
View Full Code Here


                + doctype.getPublicID() + "\", \""
                + doctype.getSystemID() +
                        "\");");
        breakLine();
        Document doc = doctype.getDocument();
        int root = doc.indexOf(doc.getRootElement());
        writeRaw("doc.insertChild(doctype, " + root + ");");
        breakLine();

    }
   
View Full Code Here

   
    protected void write(Comment comment) throws IOException {
        String parent = (String) parents.peek();
        if (parent.equals("doc")) {
            Document doc = comment.getDocument();
            int root = doc.indexOf(comment);
            writeRaw(parent + ".insertChild(new Comment(\""
              + escapeText(comment.getValue()) + "\"), "
              + root + ");");           
        }
        else {
View Full Code Here

      ProcessingInstruction xmlstylesheet = new ProcessingInstruction("xml-stylesheet",
       "type=\"text/css\" href=\"standard.css\"");
      doc.insertChild(xmlstylesheet, 0);
      Comment comment = new Comment(
       "An example from Chapter 10 of Processing XML with Java");
      doc.insertChild(comment, doc.indexOf(root));
      Element desc = new Element("desc", "http://www.w3.org/2000/svg");
      root.appendChild(desc);
      Text descText = new Text("An example from Processing XML with Java");
      desc.appendChild(descText);
     
View Full Code Here

        if (current instanceof Comment
          || current instanceof ProcessingInstruction) {      
            Document document = current.getDocument();
            ParentNode root = document.getRootElement();
            current.detach();
            document.insertChild(current, document.indexOf(root));     
        }
        else {
            for (int i = 0; i < current.getChildCount(); i++) {
                processNode(current.getChild(i));
            }
View Full Code Here

                                doc.setRootElement((Element) child);
                                break;  
                            }
                            else {
                                doc.insertChild(
                                  child, doc.indexOf(element)
                                );
                            }

                        }
                        // epilog
View Full Code Here

                            }

                        }
                        // epilog
                        Element root = doc.getRootElement();
                        int position = doc.indexOf(root);
                        for (int j=i; j < replacements.size(); j++) {
                            doc.insertChild(
                              replacements.get(j), position+1+j-i
                            );                            
                        }
View Full Code Here

                                doc.setRootElement((Element) child);
                                break;  
                            }
                            else {
                                doc.insertChild(
                                  child, doc.indexOf(element)
                                );
                            }

                        }
                        // epilog
View Full Code Here

                            }

                        }
                        // epilog
                        Element root = doc.getRootElement();
                        int position = doc.indexOf(root);
                        for (int j=i; j < replacements.size(); j++) {
                            doc.insertChild(
                              replacements.get(j), position+1+j-i
                            );                            
                        }
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.