Package com.alibaba.citrus.util.templatelite

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


  public void testOutputElementMixedMultiText() {
    // this test has mixed content (text-type and not text type).
    // and, it has a multi-text-type at the end.
    Element root = new Element("root");
    root.addContent(new Comment("Boo"));
    root.addContent(new Text(" "));
    root.addContent(new Text("txt"));
    FormatSetup fs = new FormatSetup() {
      @Override
      public void setup(Format fmt) {
        fmt.setExpandEmptyElements(true);
      }
View Full Code Here


  public void testOutputElementMixedMultiZeroText() {
    // this test has mixed content (text-type and not text type).
    // and, it has a multi-text-type at the end.
    Element root = new Element("root");
    root.addContent(new Comment("Boo"));
    root.addContent(new Text(""));
    root.addContent(new Text(" "));
    root.addContent(new Text(""));
    root.addContent(new Text("txt"));
    root.addContent(new Text(""));
    FormatSetup fs = new FormatSetup() {
      @Override
      public void setup(Format fmt) {
        fmt.setExpandEmptyElements(true);
      }
View Full Code Here

  public void testOutputElementInterleavedEmptyText() {
    // this is to test issue #72
    // Compact format only prints first child.
    // and, it has a multi-text-type at the end.
    Element root = new Element("root");
    root.addContent(new Text(" "));
    root.addContent(new Comment("Boo"));
    root.addContent(new Text(" "));
    root.addContent(new Element("child"));
    root.addContent(new Text(" "));
    root.addContent(new ProcessingInstruction("pitarget"));
    root.addContent(new Text(" "));
    checkOutput(root, 
        "<root> <!--Boo--> <child /> <?pitarget?> </root>",
        "<root><!--Boo--><child /><?pitarget?></root>",
        "<root>\n  <!--Boo-->\n  <child />\n  <?pitarget?>\n</root>",
        "<root>\n  <!--Boo-->\n  <child />\n  <?pitarget?>\n</root>",
View Full Code Here

  @Test
  public void testOutputElementMultiEntityLeftRight() {
    Element root = new Element("root");
    root.addContent(new EntityRef("erl"));
    root.addContent(new Text(" "));
    root.addContent(new Text("    "));
    root.addContent(new EntityRef("err"));
    checkOutput(root,
        "<root>&erl;     &err;</root>",
        "<root>&erl; &err;</root>",
        "<root>&erl;     &err;</root>",
View Full Code Here

  }

  @Test
  public void testOutputElementMultiTrimLeftRight() {
    Element root = new Element("root");
    root.addContent(new Text(" tl "));
    root.addContent(new Text(" mid "));
    root.addContent(new Text(" tr "));
    checkOutput(root,
        "<root> tl  mid  tr </root>",
        "<root>tl mid tr</root>",
        "<root>tl  mid  tr</root>",
        "<root>tl  mid  tr</root>",
View Full Code Here

  @Test
  public void testOutputElementMultiCDATALeftRight() {
    Element root = new Element("root");
    root.addContent(new CDATA(" tl "));
    root.addContent(new Text(" mid "));
    root.addContent(new CDATA(" tr "));
    checkOutput(root,
        "<root><![CDATA[ tl ]]> mid <![CDATA[ tr ]]></root>",
        "<root><![CDATA[tl]]> mid <![CDATA[tr]]></root>",
        "<root><![CDATA[tl ]]> mid <![CDATA[ tr]]></root>",
View Full Code Here

  public void testOutputEscapedMixedMultiText() {
    // this test has mixed content (text-type and not text type).
    // and, it has a multi-text-type at the end.
    Element root = new Element("root");
    root.addContent(new Comment("Boo"));
    root.addContent(new Text(" xx "));
    root.addContent(new Text("<emb>"));
    root.addContent(new Text(" xx "));
    FormatSetup fs = new FormatSetup() {
      @Override
      public void setup(Format fmt) {
        fmt.setExpandEmptyElements(true);
      }
View Full Code Here

    @Test
    public void test_ErrorSurrogatePairOutput() throws JDOMException, IOException, XMLStreamException {
      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");
      StAXStreamOutputter outputter = new StAXStreamOutputter(format);
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      XMLStreamWriter xsw = soutfactory.createXMLStreamWriter(baos);
View Full Code Here

  public void testTrimFullWhite() throws XMLStreamException {
    // 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);
    StAXStreamOutputter xout = new StAXStreamOutputter(mf);
    StringWriter sw = new StringWriter();
    XMLStreamWriter xsw = soutfactory.createXMLStreamWriter(sw);
View Full Code Here

    List<Content> list = new ArrayList<Content>();
    list.add(new ProcessingInstruction("jdomtest", ""));
    list.add(new Comment("comment"));
    list.add(new CDATA("foo"));
    list.add(new Element("root"));
    list.add(new Text("bar"));
    roundTripFragment(list);
  }
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.