Package com.alibaba.citrus.util.templatelite

Examples of com.alibaba.citrus.util.templatelite.Template$Text


  public void testOutputFragmentContent() {
    roundTripFragment(new ProcessingInstruction("jdomtest", ""));
    roundTripFragment(new Comment("comment"));
    roundTripFragment(new CDATA("foo"));
    roundTripFragment(new Element("root"));
    roundTripFragment(new Text("bar"));
  }
View Full Code Here


    final FormatStack fstack = new FormatStack(format);
    final Walker walker = buildWalker(fstack, list, false);
    if (walker.hasNext()) {
      final Content c = walker.next();
      if (c == null) {
        return printText(fstack, basedoc, new Text(walker.text()));
      }
      if (c.getCType() == CType.Text) {
        return printText(fstack, basedoc, (Text)c);
      }
    }
View Full Code Here

        // Formatted Text or CDATA
        final String text = walker.text();
        if (walker.isCDATA()) {
          n = printCDATA(fstack, basedoc, new CDATA(text));
        } else {
          n = printText(fstack, basedoc, new Text(text));
        }
      } else {
        n = helperContentDispatcher(fstack, nstack,
            basedoc, c);
      }
View Full Code Here

    final FormatStack fstack = new FormatStack(format);
    final Walker walker = buildWalker(fstack, list, false);
    if (walker.hasNext()) {
      final Content c = walker.next();
      if (c == null) {
        printText(out, fstack, new Text(walker.text()));
      } else if (c.getCType() == CType.Text) {
        printText(out, fstack, (Text)c);
      }
    }
    out.flush();
View Full Code Here

          try {
            fstack.setTextMode(textmode);
            if (!walker.isAllText() && fstack.getPadBetween() != null) {
              // we need to newline/indent
              final String indent = fstack.getPadBetween();
              printText(out, fstack, new Text(indent));
            }
           
            printContent(out, fstack, nstack, walker);
           
            if (!walker.isAllText() && fstack.getPadLast() != null) {
              // we need to newline/indent
              final String indent = fstack.getPadLast();
              printText(out, fstack, new Text(indent));
            }
          } finally {
            fstack.pop();
          }
        }
View Full Code Here

     
      if (content == null) {
        if (walker.isCDATA()) {
          printCDATA(out, fstack, new CDATA(walker.text()));
        } else {
          printText(out, fstack, new Text(walker.text()));
        }
      } else {
        switch (content.getCType()) {
          case CDATA:
            printCDATA(out, fstack, (CDATA) content);
View Full Code Here

    @Test
    public void test_ErrorSurrogatePairOutput() throws JDOMException, IOException {
      SAXBuilder builder = new SAXBuilder();
      builder.setExpandEntities(true);
      Document doc = builder.build(new StringReader("<?xml version=\"1.0\"?><root></root>"));
      Text t = new UncheckedJDOMFactory().text("\uD800\uDBFF");
      doc.getRootElement().setContent(t);
      Format format = Format.getCompactFormat().setEncoding("ISO-8859-1");
      XMLOutputter outputter = new XMLOutputter(format);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      try {
View Full Code Here

  public void testTrimFullWhite() {
    // See issue #31.
    // https://github.com/hunterhacker/jdom/issues/31
    // This tests should pass when issue 31 is resolved.
    Element root = new Element("root");
    root.addContent(new Text(" "));
    root.addContent(new Text("x"));
    root.addContent(new Text(" "));
    Format mf = Format.getRawFormat();
    mf.setTextMode(TextMode.TRIM_FULL_WHITE);
    XMLOutputter xout = new XMLOutputter(mf);
    String output = xout.outputString(root);
    assertEquals("<root> x </root>", output);
View Full Code Here

 
  @Test
  public void testOutputElementIgnoreTrAXEscapingPIs() {
    Element root = new Element("root");
    root.addContent(new Text("&"));
    root.addContent(new ProcessingInstruction(Result.PI_DISABLE_OUTPUT_ESCAPING, ""));
    root.addContent(new Text(" && "));
    root.addContent(new ProcessingInstruction(Result.PI_ENABLE_OUTPUT_ESCAPING, ""));
    root.addContent(new Text("&"));
    String expect = "<root>&amp; && &amp;</root>";
    String excompact = "<root>&amp;&&&amp;</root>";
    String expretty = "<root>\n  &amp;\n  \n  &&\n  \n  &amp;\n</root>";
    String extfw = "<root>\n  &amp;\n  \n   && \n  \n  &amp;\n</root>";
    checkOutput(root,
View Full Code Here

  public void testCRNLEscaping() {
    Document doc = new Document();
    Element root = new Element("root");
    Element child1 = new Element("child1");
    Element child2 = new Element("child2");
    Text stuff = new Text("foo");
    root.addContent(child1);
    root.addContent(stuff);
    root.addContent(child2);
    doc.setRootElement(root);
    XMLOutputter xout = new XMLOutputter(Format.getPrettyFormat());
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.util.templatelite.Template$Text

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.