Package nu.xom

Examples of nu.xom.Comment


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


    public void testPrologAndEpilog()
      throws IOException, ParsingException {
       
        serializeParseAndCompare(doc);

        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 testIndentAndBreakBeforeComment() throws IOException {
       
        Element items = new Element("itemSet");
        items.appendChild(new Comment("item1"));
        Document doc = new Document(items);
        Serializer serializer = new Serializer(out);
        serializer.setIndent(4);
        serializer.write(doc);
        serializer.flush();
View Full Code Here

   
    public void testWhiteSpaceBetweenCommentsIsBoundaryWhiteSpace()
      throws IOException {
       
        Element items = new Element("itemSet");
        items.appendChild(new Comment("item1"));
        items.appendChild("      \r\n              ");
        items.appendChild(new Comment("item2"));
        Document doc = new Document(items);
        Serializer serializer = new Serializer(out);
        serializer.setIndent(4);
        serializer.write(doc);
        serializer.flush();
View Full Code Here

    public void testWhiteSpaceBeforeCommentIsBoundaryWhiteSpace()
      throws IOException {
       
        Element items = new Element("itemSet");
        items.appendChild("      \r\n              ");
        items.appendChild(new Comment("item1"));
        items.appendChild(new Comment("item2"));
        Document doc = new Document(items);
        Serializer serializer = new Serializer(out);
        serializer.setIndent(4);
        serializer.write(doc);
        serializer.flush();
View Full Code Here

   
    public void testWhiteSpaceAfterCommentsIsBoundaryWhiteSpace()
      throws IOException {
       
        Element items = new Element("itemSet");
        items.appendChild(new Comment("item1"));
        items.appendChild(new Comment("item2"));
        items.appendChild("      \r\n              ");
        Document doc = new Document(items);
        Serializer serializer = new Serializer(out);
        serializer.setIndent(4);
        serializer.write(doc);
View Full Code Here

   
    public void testNFCInComment() throws IOException {
       
        Element root = new Element("a");
        Document doc = new Document(root);
        doc.insertChild(new Comment("c\u0327hat"), 0); // c with combining cedilla
        Serializer serializer = new Serializer(out);
        serializer.setUnicodeNormalizationFormC(true);
        serializer.write(doc);
        serializer.flush();
        out.close();
View Full Code Here

   */
  private void saveFile(String filename, Resource resource) throws IOException {
    FileOutputStream os = null;
    try {
      Document doc = new Document(resource.getXOMElementCopy());
      doc.insertChild(new Comment(" Generated by Escort in DDMSence v" + PropertyReader.getProperty("version")
        + " "), 0);
      File outputFile = new File(PropertyReader.getProperty("sample.data"), filename);
      os = new FileOutputStream(outputFile);
      Serializer serializer = new Serializer(os);
      serializer.setIndent(3);
View Full Code Here

        return new Text(text.getValue());
    }

   
    private Node copy(Comment comment) {
        return new Comment(comment.getValue());
    }
View Full Code Here

     *
     * @throws XMLException if the DOM comment is not a well-formed
     *     XML comment
     */
    public static Comment convert(org.w3c.dom.Comment comment) {      
        return new Comment(comment.getNodeValue());
    }
View Full Code Here

TOP

Related Classes of nu.xom.Comment

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.