Package nu.xom

Examples of nu.xom.ProcessingInstruction


        Element parent = new Element("Test");
        Element child = new Element("child");
        parent.appendChild(child);
        grandparent.appendChild(parent);
       
        ProcessingInstruction p1 = new ProcessingInstruction("c1", "1");
        ProcessingInstruction p2 = new ProcessingInstruction("c1", "2");
        ProcessingInstruction p3 = new ProcessingInstruction("c1", "3");
        ProcessingInstruction p4 = new ProcessingInstruction("c1", "4");
       
        doc.insertChild(p1, 0);
        grandparent.insertChild(p2, 0);
        parent.insertChild(p3, 0);
        child.insertChild(p4, 0);
View Full Code Here


       
        doc.insertChild(c1, 0);
        grandparent.insertChild(c2, 0);
        parent.insertChild(c3, 0);
        child.insertChild(c4, 0);
        ProcessingInstruction pi = new ProcessingInstruction("appendix", "text");
        doc.appendChild(pi);
        ProcessingInstruction pi2 = new ProcessingInstruction("test", "text");
        parent.appendChild(pi2);
       
        Nodes result = doc.query("descendant::processing-instruction('test')");
        assertEquals(1, result.size());
        assertEquals(pi2, result.get(0));
View Full Code Here

   
    public void testProcessingInstruction()
      throws IOException, ParsingException {
       
        String data = "<>&amp;&entity; test   \n  hello again";
        root.appendChild(new ProcessingInstruction("target", data));
        serializeParseAndCompare(doc);
       
    }
View Full Code Here

        doc.insertChild(new Comment("Hello"), 0);
        serializeParseAndCompare(doc);   
        doc.insertChild(new DocType("root"), 0);
        serializeParseAndCompare(doc);   
        doc.insertChild(new ProcessingInstruction("test", "some data"),
          0);
        serializeParseAndCompare(doc);   
        doc.insertChild(new Comment("Goodbye"), 0);
        serializeParseAndCompare(doc);   
        doc.insertChild(
          new ProcessingInstruction("goodbye", "some data"), 0);
        serializeParseAndCompare(doc);   
        doc.appendChild(new Comment("Hello"));
        serializeParseAndCompare(doc);   
        doc.appendChild(
          new ProcessingInstruction("test", "some data"));
        serializeParseAndCompare(doc);   
       
    }
View Full Code Here

   
    public void testIndentAndBreakBeforeProcessingInstruction()
      throws IOException {
       
        Element items = new Element("itemSet");
        items.appendChild(new ProcessingInstruction("target", "value"));
        Document doc = new Document(items);
        Serializer serializer = new Serializer(out);
        serializer.setIndent(4);
        serializer.write(doc);
        serializer.flush();
View Full Code Here

    }

   
    public void testNFCInProcessingInstruction() throws IOException {
       
        doc.appendChild(new ProcessingInstruction("c\u0327hat", "c\u0327hat"));
        Serializer serializer = new Serializer(out);
        serializer.setUnicodeNormalizationFormC(true);
        serializer.write(doc);
        serializer.flush();
        out.close();
View Full Code Here

        e.appendChild(new Text(" moredata"));
        assertEquals(e.getValue(), "data moredata");
        e.appendChild(new Comment(" moredata"));
        assertEquals(e.getValue(), "data moredata");
        e.appendChild(
          new ProcessingInstruction("target", "moredata"));
        assertEquals(e.getValue(), "data moredata");
       
        Element e2 = new Element("child");
        e.appendChild(e2);
        assertEquals("data moredata", e.getValue());
View Full Code Here

        Attribute a1 = new Attribute("test", "test");      
        parent.addAttribute(a1);
       
        Node child1 = new Text("http://www.mauve.com");
        parent.appendChild(child1);
        Node child2 = new ProcessingInstruction(
          "child", "http://www.mauve.com");
        parent.appendChild(child2);
        Node child3 = new Comment("http://www.mauve.com");
        parent.appendChild(child3);
 
        assertEquals(parent, child3.getParent());
        assertEquals(parent, child1.getParent());
        assertEquals(parent, child2.getParent());
      
        Nodes result = parent.removeChildren();
        assertEquals(0, parent.getChildCount());
        assertNull(child1.getParent());
        assertNull(child2.getParent());
        assertNull(child3.getParent());
        assertEquals(parent, a1.getParent());
       
        assertEquals(3, result.size());
        assertEquals(child1, result.get(0));
View Full Code Here

      if (current instanceof Element) {
          Element temp = (Element) current;
          data = ": " + temp.getQualifiedName();  
      }
      else if (current instanceof ProcessingInstruction) {
          ProcessingInstruction temp = (ProcessingInstruction) current;
          data = ": " + temp.getTarget();  
      }
      else if (current instanceof DocType) {
          DocType temp = (DocType) current;
          data = ": " + temp.getRootElementName();  
      }
      else if (current instanceof Text || current instanceof Comment) {
          String value = current.getValue();
          value = value.replace('\n', ' ').trim();
          if (value.length() <= 20) data = ": " + value;
View Full Code Here

TOP

Related Classes of nu.xom.ProcessingInstruction

Copyright © 2018 www.massapicom. 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.