Package er.xiss

Examples of er.xiss.ERXML$Text


    @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

        // add properties
        for (Map.Entry<String, Object> entry : representation.getProperties().entrySet()) {
            Element propertyElement = new Element(entry.getKey());
            if (entry.getValue() != null) {
                propertyElement.setContent(new Text(entry.getValue().toString()));
            } else {
                propertyElement.setAttribute("nil", "true", XSI_NAMESPACE);
            }
            resourceElement.addContent(propertyElement);
        }
View Full Code Here

    for (int i = 0; i < missions.size(); i++) {
      Element mission = new Element("mission");
      mission.setAttribute("id", i + "");

      Element title = new Element("title");
      title.addContent(new Text(this.missionsName.get(i)));
      mission.addContent(title);

      Element text = new Element("text");
      text.addContent(new Text(this.missions.get(i)));
      mission.addContent(text);

      game.addContent(mission);
    }
View Full Code Here

        }
        Content content = htmlContent.get(0);
        if(!(content instanceof Text)) {
            return null;
        }
        Text htmlText = (Text) content;
        return normalized(htmlText.getValue());
    }
View Full Code Here

            try {
                switch (bufferType) {
                    case Float: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final float[] floatArray = new float[count];
                        for (int i = 0; i < count; i++) {
                            floatArray[i] = parseFloat(tokenizer.nextToken());
                        }

                        dataCache.getFloatArrays().put(currentElement, floatArray);

                        return new Text("");
                    }
                    case Double: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final double[] doubleArray = new double[count];
                        for (int i = 0; i < count; i++) {
                            doubleArray[i] = Double.parseDouble(tokenizer.nextToken().replace(",", "."));
                        }

                        dataCache.getDoubleArrays().put(currentElement, doubleArray);

                        return new Text("");
                    }
                    case Int: {
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        final int[] intArray = new int[count];
                        int i = 0;
                        while (tokenizer.hasMoreTokens()) {
                            intArray[i++] = Integer.parseInt(tokenizer.nextToken());
                        }

                        dataCache.getIntArrays().put(currentElement, intArray);

                        return new Text("");
                    }
                    case P: {
                        list.clear();
                        final String normalizedText = Text.normalizeString(text);
                        if (normalizedText.length() == 0) {
                            return new Text("");
                        }
                        final StringTokenizer tokenizer = new StringTokenizer(normalizedText, " ");
                        while (tokenizer.hasMoreTokens()) {
                            list.add(tokenizer.nextToken());
                        }
                        final int listSize = list.size();
                        final int[] intArray = new int[listSize];
                        for (int i = 0; i < listSize; i++) {
                            intArray[i] = Integer.parseInt(list.get(i));
                        }

                        dataCache.getIntArrays().put(currentElement, intArray);

                        return new Text("");
                    }
                    default:
                        break;
                }
            } catch (final NoSuchElementException e) {
                throw new ColladaException("Number of values in collada array does not match its count attribute: "
                        + count, e);
            }
            return new Text(Text.normalizeString(text));
        }
View Full Code Here

        }
        Content content = htmlContent.get(0);
        if(!(content instanceof Text)) {
            return null;
        }
        Text htmlText = (Text) content;
        return normalized(htmlText.getValue());
    }
View Full Code Here

TOP

Related Classes of er.xiss.ERXML$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.