// Act
Document document = XMLParser.parse(xmlContent);
// Assert
Element documentElement = document.getDocumentElement();
assertEquals("beans", documentElement.getTagName());
Element beans = (Element) document.getFirstChild();
assertEquals("beans", beans.getTagName());
assertNull(beans.getNextSibling());
assertNull(beans.getPreviousSibling());
Element testBean = document.getElementById("testBean");
NodeList beanList = document.getElementsByTagName("bean");
assertEquals(2, beanList.getLength());
assertEquals("testBean", beanList.item(0).getAttributes().getNamedItem("id").getNodeValue());
assertEquals("bean", testBean.getTagName());
assertEquals("bean", testBean.getNodeName());
assertEquals("http://www.springframework.org/schema/beans", testBean.getNamespaceURI());
assertEquals("org.springframework.beans.TestBean", testBean.getAttribute("class"));
assertTrue(testBean.hasAttribute("class"));
assertFalse(testBean.hasAttribute("fooAttr"));
Attr classAttr = testBean.getAttributeNode("class");
assertEquals("class", classAttr.getName());
assertEquals("org.springframework.beans.TestBean", classAttr.getValue());
assertEquals("http://www.springframework.org/schema/beans", classAttr.getNamespaceURI());
assertEquals("class", classAttr.getNodeName());
// CDATA attribute
Element ageProperty = (Element) testBean.getChildNodes().item(0);
assertEquals(1, ageProperty.getAttributes().getLength());
assertEquals("age", ageProperty.getAttribute("name"));
assertEquals("<10>", ageProperty.getNodeValue());
// TODO : pass this assertion
// assertEquals("#cdata-section",
// ageProperty.getFirstChild().getNodeName());
// "spouse" child bean assertions
NamedNodeMap innerBeanAgePropertyAttributes = beanList.item(1).getChildNodes().item(0).getAttributes();
assertEquals("age", innerBeanAgePropertyAttributes.getNamedItem("name").getNodeValue());
assertEquals("11", innerBeanAgePropertyAttributes.getNamedItem("value").getNodeValue());
// bean from "util" namespace
Element name = (Element) testBean.getNextSibling();
assertEquals("property-path", name.getTagName());
assertEquals("property-path", name.getNodeName());
assertEquals("http://www.springframework.org/schema/util", name.getNamespaceURI());
}