Package org.codehaus.jettison

Examples of org.codehaus.jettison.AbstractXMLStreamWriter.writeEndDocument()


        w.writeStartElement("subchild1");
        w.writeCharacters("sub1");
        w.writeEndElement();
       
        w.writeEndElement();
        w.writeEndDocument();
       
        w.close();
        strWriter.close();
        String expected = "{\"root\":{\"subchild1\":[{\"subchild2\":[5,3.14,true,\"000123\",\"Infinity\"]},\"sub1\"]}}";
        String actual = strWriter.toString();
View Full Code Here


        w.writeCharacters("NaN");
        w.writeEndElement();


        w.writeEndElement();
        w.writeEndDocument();

        w.close();
        strWriter.close();
        String expected = "{\"root\":{\"subchild1\":[\"Infinity\",\"NaN\"]}}";
        String actual = strWriter.toString();
View Full Code Here

        w.writeAttribute("class", "string");
        w.writeCharacters("1");
        w.writeEndElement();
       
        w.writeEndElement();
        w.writeEndDocument();
       
        w.close();
        strWriter.close();
       
        assertEquals("{\"a\":{\"o\":{\"@class\":\"string\",\"$\":\"1\"}}}", strWriter.toString());
View Full Code Here

    w.writeCharacters("1");
    w.writeEndElement();
    w.writeEndElement();

    w.writeEndElement();
    w.writeEndDocument();

    w.close();
    strWriter.close();

    assertEquals("{\"array-a\":[{\"a\":{\"n\":1}}]}", strWriter.toString());
View Full Code Here

        w.writeStartDocument();
        w.writeStartElement("", "array-a", "");

        w.writeEndElement();
        w.writeEndDocument();

        w.close();
        strWriter.close();

        assertEquals("{\"array-a\":[\"\"]}", strWriter.toString());
View Full Code Here

        w.writeEndElement(); // host
        w.writeEndElement(); //hosts

        w.writeEndElement(); // doc
        w.writeEndElement(); // docs
        w.writeEndDocument();

        w.close();
        strWriter.close();

        assertEquals("{\"docs\":[{\"doc\":{\"id\":24,\"filters\":[\"\"],\"hosts\":[{\"host\":{\"name\":\"foobar.com\",\"ip\":\"255.255.255.255\"}}]}}]}", strWriter.toString());
View Full Code Here

    w.writeCharacters("1");
    w.writeEndElement();
    w.writeEndElement();

    w.writeEndElement();
    w.writeEndDocument();

    w.close();
    strWriter.close();

    assertEquals("{\"array-a\":{\"a\":{\"n\":1}}}", strWriter.toString());
View Full Code Here

        w.writeAttribute("x", "z");
        w.writeCharacters("value");
        w.writeEndElement();       
       
        w.writeEndElement();
        w.writeEndDocument();
       
        w.close();
        strWriter.close();
       
        assertEquals("{\"root\":{\"child\":[{\"@x\":\"y\",\"$\":\"value\"},{\"@a\":\"b\",\"$\":\"value\"},{\"@x\":\"z\",\"$\":\"value\"}]}}", strWriter.toString());
View Full Code Here

        w.writeStartDocument();
        w.writeStartElement("root");
        w.writeCharacters("true");
        w.writeEndElement();

        w.writeEndDocument();

        w.close();
        strWriter.close();

        assertEquals("{\"root\":\"true\"}", strWriter.toString());       
View Full Code Here

        w.writeStartElement("root");
        w.writeAttribute("att", "attvalue");
        w.writeAttribute("http://foo/", "att2", "attvalue");
       
        w.writeEndElement();
        w.writeEndDocument();
       
        w.close();
        strWriter.close();
       
        assertEquals("{\"root\":{\"!att\":\"attvalue\",\"!foo.att2\":\"attvalue\"}}", strWriter.toString());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.