NamedNodeMapRemoveNamedItemNS.java revision adc854b798c1cfe3bfd4c27d68d5cee38ca617da
161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson/* 261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson This Java source file was generated by test-to-java.xsl 361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson and is a derived work from the source document. 461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson The source document contained the following notice: 561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Copyright (c) 2001 World Wide Web Consortium, 961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson (Massachusetts Institute of Technology, Institut National de 1061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Recherche en Informatique et en Automatique, Keio University). All 1161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Rights Reserved. This program is distributed under the W3C's Software 1261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Intellectual Property License. This program is distributed in the 1361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson hope that it will be useful, but WITHOUT ANY WARRANTY; without even 1461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 1561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson PURPOSE. 1661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 1761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson See W3C License http://www.w3.org/Consortium/Legal/ for more details. 1861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 1961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 2061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson */ 2161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 2261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonpackage tests.org.w3c.dom; 2361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 2461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport dalvik.annotation.TestTargets; 2561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport dalvik.annotation.TestLevel; 2661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport dalvik.annotation.TestTargetNew; 2761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport dalvik.annotation.TestTargetClass; 2861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 2961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.NamedNodeMap; 3061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.Document; 3161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.Node; 3261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.NodeList; 3361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.Attr; 3461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.Element; 3561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport org.w3c.dom.DOMException; 3661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 3761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonimport javax.xml.parsers.DocumentBuilder; 3861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 3961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson/** 4061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * The method removeNamedItemNS removes a node specified by local name and 4161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * namespace 4261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * 4361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * Retreive an attribute node and then remove from the NamedNodeMap. Verify if 4461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * the attribute node was actually remove from the node map. 4561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * 4661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * @author IBM 4761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * @author Neil Delima 4861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * @see <a 4961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D58B193</a> 5061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson */ 5161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson@TestTargetClass(NamedNodeMap.class) 5261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardsonpublic final class NamedNodeMapRemoveNamedItemNS extends DOMTestCase { 5361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 5461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson DOMDocumentBuilderFactory factory; 5561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 5661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson DocumentBuilder builder; 5761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 5861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson protected void setUp() throws Exception { 5961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson super.setUp(); 6061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson try { 6161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 6261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson .getConfiguration2()); 6361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson builder = factory.getBuilder(); 6461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } catch (Exception e) { 6561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson fail("Unexpected exception" + e.getMessage()); 6661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 6761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 6861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 6961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson protected void tearDown() throws Exception { 7061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson factory = null; 7161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson builder = null; 7261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson super.tearDown(); 7361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 7461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 7561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson /** 7661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * Runs the test case. 7761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * 7861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * @throws Throwable 7961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson * Any uncaught exception causes test to fail 8061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson */ 8161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 8261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 8361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Doesn't verify DOMException.", 8461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 8561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 8661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 8761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS1() throws Throwable { 8861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 8961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 9061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Node element; 9161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute; 9261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 9361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 9461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 9561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "address"); 9661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = elementList.item(1); 9761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 9861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov", 9961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "domestic"); 10061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov", 10161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "domestic"); 10261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertNull("namednodemapremovenameditemns01", attribute); 10361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 10461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 10561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Assumes validation. 10661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// public void testRemoveNamedItemNS2() throws Throwable { 10761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Document doc; 10861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// NamedNodeMap attributes; 10961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Node element; 11061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Attr attribute; 11161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// NodeList elementList; 11261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// String attrValue; 11361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// String nullNS = null; 11461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 11561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// doc = (Document) load("staffNS", builder); 11661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 11761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// "employee"); 11861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// element = elementList.item(1); 11961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// attributes = element.getAttributes(); 12061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// attribute = (Attr) attributes.removeNamedItemNS(nullNS, "defaultAttr"); 12161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// attribute = (Attr) attributes.getNamedItemNS(nullNS, "defaultAttr"); 12261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// attrValue = attribute.getNodeValue(); 12361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// assertNotNull("namednodemapremovenameditemns02", attribute); 12461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// assertEquals("namednodemapremovenameditemns02_attrValue", "defaultVal", 12561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// attrValue); 12661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 12761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 12861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 12961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Doesn't verify DOMException.", 13061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 13161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 13261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 13361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS3() throws Throwable { 13461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 13561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 13661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Node element; 13761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute; 13861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 13961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute1; 14061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute2; 14161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson String nodeName; 14261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 14361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = doc.createElementNS("http://www.w3.org/DOM/Test", "root"); 14461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute1 = doc 14561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson .createAttributeNS("http://www.w3.org/DOM/L1", "L1:att"); 14661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ((Element) /* Node */element).setAttributeNodeNS(attribute1); 14761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute2 = doc 14861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson .createAttributeNS("http://www.w3.org/DOM/L2", "L2:att"); 14961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ((Element) /* Node */element).setAttributeNodeNS(attribute2); 15061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 15161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.removeNamedItemNS( 15261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "http://www.w3.org/DOM/L1", "att"); 15361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.getNamedItemNS( 15461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "http://www.w3.org/DOM/L2", "att"); 15561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson nodeName = attribute.getNodeName(); 15661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertEquals("namednodemapremovenameditemns02", "L2:att", nodeName); 15761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 15861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 15961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 16061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Doesn't verify DOMException.", 16161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 16261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 16361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 16461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void _testRemoveNamedItemNS4() throws Throwable { 16561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 16661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 16761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Node element; 16861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute; 16961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 17061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 17161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 17261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("*", "employee"); 17361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = elementList.item(0); 17461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 17561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/", "xmlns"); 17661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.getNamedItemNS( 17761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "http://www.w3.org/2000/xmlns/", "xmlns"); 17861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertNull("namednodemapremovenameditemns04_1", attribute); 17961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes.removeNamedItemNS("http://www.w3.org/2000/xmlns/", "dmstc"); 18061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.getNamedItemNS( 18161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "http://www.w3.org/2000/xmlns/", "dmstc"); 18261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertNull("namednodemapremovenameditemns04_2", attribute); 18361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 18461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 18561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Assumes validation. 18661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// public void testRemoveNamedItemNS5() throws Throwable { 18761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// Document doc; 18861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// DocumentType docType; 18961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// NamedNodeMap entities; 19061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// NamedNodeMap notations; 19161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 19261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// String nullNS = null; 19361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 19461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// doc = (Document) load("staffNS", builder); 19561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// docType = doc.getDoctype(); 19661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// entities = docType.getEntities(); 19761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// assertNotNull("entitiesNotNull", entities); 19861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// notations = docType.getNotations(); 19961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// assertNotNull("notationsNotNull", notations); 20061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 20161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// try { 20261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// entities.removeNamedItemNS(nullNS, "ent1"); 20361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// fail("entity_throw_DOMException"); 20461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 20561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } catch (DOMException ex) { 20661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// switch (ex.code) { 20761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// case 8: 20861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// break; 20961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// case 7: 21061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// break; 21161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// default: 21261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// throw ex; 21361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 21461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 21561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 21661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// try { 21761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// notations.removeNamedItemNS(nullNS, "notation1"); 21861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// fail("notation_throw_DOMException"); 21961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// 22061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } catch (DOMException ex) { 22161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// switch (ex.code) { 22261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// case 8: 22361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// break; 22461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// case 7: 22561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// break; 22661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// default: 22761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// throw ex; 22861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 22961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 23061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson// } 23161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 23261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 23361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", 23461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 23561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 23661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 23761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS6() throws Throwable { 23861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 23961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 24061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Node element; 24161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 24261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 24361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 24461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 24561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "employee"); 24661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = elementList.item(1); 24761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 24861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 24961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson { 25061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson boolean success = false; 25161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson try { 25261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes.removeNamedItemNS("http://www.Nist.gov", "domestic"); 25361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } catch (DOMException ex) { 25461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson success = (ex.code == DOMException.NOT_FOUND_ERR); 25561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 25661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertTrue("throw_NOT_FOUND_ERR", success); 25761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 25861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 25961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 26061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 26161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", 26261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 26361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 26461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 26561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS7() throws Throwable { 26661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 26761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 26861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Node element; 26961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 27061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 27161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 27261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 27361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "employee"); 27461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = elementList.item(1); 27561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 27661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 27761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson { 27861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson boolean success = false; 27961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson try { 28061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes.removeNamedItemNS("http://www.nist.gov", "domestic"); 28161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } catch (DOMException ex) { 28261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson success = (ex.code == DOMException.NOT_FOUND_ERR); 28361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 28461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertTrue("throw_NOT_FOUND_ERR", success); 28561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 28661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 28761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 28861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 28961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Verifies that removeNamedItemNS method throws DOMException with NOT_FOUND_ERR code.", 29061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 29161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 29261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 29361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS8() throws Throwable { 29461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 29561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 29661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Element element; 29761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 29861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 29961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 30061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 30161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "address"); 30261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = (Element) elementList.item(1); 30361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 30461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element.removeAttributeNS("http://www.nist.gov", "domestic"); 30561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 30661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson { 30761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson boolean success = false; 30861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson try { 30961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes.removeNamedItemNS("http://www.nist.gov", "domestic"); 31061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } catch (DOMException ex) { 31161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson success = (ex.code == DOMException.NOT_FOUND_ERR); 31261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 31361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertTrue("throw_NOT_FOUND_ERR", success); 31461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 31561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 31661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson @TestTargetNew( 31761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson level = TestLevel.PARTIAL_COMPLETE, 31861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson notes = "Doesn't verify DOMException.", 31961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson method = "removeNamedItemNS", 32061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson args = {java.lang.String.class, java.lang.String.class} 32161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson ) 32261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson public void testRemoveNamedItemNS9() throws Throwable { 32361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Document doc; 32461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap attributes; 32561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NamedNodeMap newAttributes; 32661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Element element; 32761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson Attr attribute; 32861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson NodeList elementList; 32961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson doc = (Document) load("staffNS", builder); 33061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson elementList = doc.getElementsByTagNameNS("http://www.nist.gov", 33161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "address"); 33261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson element = (Element) elementList.item(1); 33361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attributes = element.getAttributes(); 33461362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov", 33561362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "domestic"); 33661362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson newAttributes = element.getAttributes(); 33761362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson attribute = (Attr) newAttributes.getNamedItemNS("http://www.nist.gov", 33861362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson "domestic"); 33961362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson assertNull("namednodemapremovenameditemns09", attribute); 34061362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson } 34161362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson 34261362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson} 34361362d65fcdd6f6aff90fc5be51237b39cfeb9aeBill Richardson