158 @Test
159 public void testAddNewElement() throws Exception {
160 Document document = createDOMWithNS("DocumentTest01.xml");
161
162 NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/TR/REC-html40", "body");
163 NodeList childList = nodeList.item(0).getChildNodes();
164 Element child = (Element) childList.item(1);
165 Element elem = document.createElementNS("urn:BooksAreUs.org:BookInfonew", "newElement");
166 assertNotNull(child.appendChild(elem));
167 }
168
169 /*
170 * Test createElement with unqualified xml name.
171 */
172 @Test(expectedExceptions = DOMException.class)
173 public void testCreateElementNeg() throws Exception {
174 Document doc = createNewDocument();
175 doc.createElement("!nc$%^*(!");
176 }
177 }
178
|
158 @Test
159 public void testAddNewElement() throws Exception {
160 Document document = createDOMWithNS("DocumentTest01.xml");
161
162 NodeList nodeList = document.getElementsByTagNameNS("http://www.w3.org/TR/REC-html40", "body");
163 NodeList childList = nodeList.item(0).getChildNodes();
164 Element child = (Element) childList.item(1);
165 Element elem = document.createElementNS("urn:BooksAreUs.org:BookInfonew", "newElement");
166 assertNotNull(child.appendChild(elem));
167 }
168
169 /*
170 * Test createElement with unqualified xml name.
171 */
172 @Test(expectedExceptions = DOMException.class)
173 public void testCreateElementNeg() throws Exception {
174 Document doc = createNewDocument();
175 doc.createElement("!nc$%^*(!");
176 }
177 }
|