Assert.assertEquals(1, new XmlParser().parse(s).size()); s = "<xml><child/></xml>"; Assert.assertEquals(1, new XmlParser().parse(s).size()); s = "<xml><child attr=\"qwerty\"/></xml>"; Assert.assertEquals(1, new XmlParser().parse(s).size()); Assert.assertEquals("qwerty", new XmlParser().parse(s).first().attr("attr")); Assert.assertEquals(4, new XmlParser().parse(s).size()); Assert.assertEquals("ololo", new XmlParser().parse(s).text()); Assert.assertEquals("ololo", new XmlParser().parse(s).textOwn()); s = "<xml><child/><child/><child>ololo</child></xml>"; Assert.assertEquals(3, new XmlParser().parse(s).size()); Assert.assertEquals("ololo", new XmlParser().parse(s).text()); Assert.assertEquals("", new XmlParser().parse(s).textOwn()); s = "<xml><child/><child/><child>ololo</child>lo</xml>"; Assert.assertEquals(4, new XmlParser().parse(s).size()); Assert.assertEquals("ololo lo", new XmlParser().parse(s).text()); Assert.assertEquals("lo", new XmlParser().parse(s).textOwn());