Package javax.websocket

Examples of javax.websocket.Encoder$Text


  @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

  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

TOP

Related Classes of javax.websocket.Encoder$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.