/* * Runs the test case. */ void runTest() { Document doc; NodeList acronymList; Node testNode; NamedNodeMap attributes; Attr titleAttr; String value; Text textNode; Node retval; Node lastChild; doc = (Document) baseT::load("hc_staff", true); titleAttr = doc.createAttribute(SA::construct_from_utf8("title")); textNode = doc.createTextNode(SA::construct_from_utf8("Yesterday")); retval = titleAttr.appendChild(textNode); value = titleAttr.getValue(); baseT::assertEquals("Yesterday", value, __LINE__, __FILE__); value = titleAttr.getNodeValue(); baseT::assertEquals("Yesterday", value, __LINE__, __FILE__); value = retval.getNodeValue(); baseT::assertEquals("Yesterday", value, __LINE__, __FILE__); lastChild = titleAttr.getLastChild(); value = lastChild.getNodeValue(); baseT::assertEquals("Yesterday", value, __LINE__, __FILE__); }
/* * Runs the test case. */ void runTest() { Document doc; NodeList addressList; Node testNode; NamedNodeMap attributes; Attr domesticAttr; String value; doc = (Document) baseT::load("hc_staff", false); addressList = doc.getElementsByTagName(SA::construct_from_utf8("acronym")); testNode = addressList.item(0); attributes = testNode.getAttributes(); domesticAttr = (Attr) attributes.getNamedItem(SA::construct_from_utf8("title")); value = domesticAttr.getNodeValue(); baseT::assertEquals("Yes", value, __LINE__, __FILE__); }
/* * Runs the test case. */ void runTest() { Document doc; Attr newAttrNode; String attrValue; String attrName; int attrType; doc = (Document) baseT::load("staff", true); newAttrNode = doc.createAttribute(SA::construct_from_utf8("district")); attrValue = newAttrNode.getNodeValue(); baseT::assertEquals("", attrValue, __LINE__, __FILE__); attrName = newAttrNode.getNodeName(); baseT::assertEquals("district", attrName, __LINE__, __FILE__); attrType = (int) newAttrNode.getNodeType(); baseT::assertEquals(2, attrType, __LINE__, __FILE__); }