Package org.codehaus.jettison

Examples of org.codehaus.jettison.AbstractXMLStreamReader


  
    public void testTwoChildren() throws Exception {
        JSONObject obj = new JSONObject(
                        "{ \"alice\": { \"bob\" : { \"$\": \"charlie\" }," +
                        " \"david\": { \"$\": \"edgar\"} } }");
        AbstractXMLStreamReader reader = new BadgerFishXMLStreamReader(obj);
       
        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
        assertEquals("alice", reader.getName().getLocalPart());
       
        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
        assertEquals("bob", reader.getName().getLocalPart());
        assertEquals(XMLStreamReader.CHARACTERS, reader.next());
        assertEquals("charlie", reader.getText());
        assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
        assertEquals("bob", reader.getName().getLocalPart());
       
        assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
        assertEquals("david", reader.getName().getLocalPart());
        assertEquals(XMLStreamReader.CHARACTERS, reader.next());
        assertEquals("edgar", reader.getText());
        assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
        assertEquals("david", reader.getName().getLocalPart());
       
        assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
        assertEquals("alice", reader.getName().getLocalPart());
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jettison.AbstractXMLStreamReader

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.