1 2 /* 3 This Java source file was generated by test-to-java.xsl 4 and is a derived work from the source document. 5 The source document contained the following notice: 6 7 8 9 Copyright (c) 2001-2004 World Wide Web Consortium, 10 (Massachusetts Institute of Technology, Institut National de 11 Recherche en Informatique et en Automatique, Keio University). All 12 Rights Reserved. This program is distributed under the W3C's Software 13 Intellectual Property License. This program is distributed in the 14 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 16 PURPOSE. 17 18 See W3C License http://www.w3.org/Consortium/Legal/ for more details. 19 20 21 */ 22 23 package tests.org.w3c.dom; 24 25 import javax.xml.parsers.DocumentBuilder; 26 27 import org.w3c.dom.Document; 28 import org.w3c.dom.Element; 29 import org.w3c.dom.NodeList; 30 31 32 /** 33 * The method getAttributeNS retrieves an attribute value by local name and namespace URI. 34 * Using the getAttributeNodeNS, retreive and verify the value of the default 35 * attribute node. 36 * 37 * @author IBM 38 * @author Neil Delima 39 * @see <a href="http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS">http://www.w3.org/TR/DOM-Level-2-Core/core#ID-ElGetAttrNS</a> 40 * @see <a href="http://www.w3.org/Bugs/Public/show_bug.cgi?id=259">http://www.w3.org/Bugs/Public/show_bug.cgi?id=259</a> 41 */ 42 public final class ElementGetAttributeNS extends DOMTestCase { 43 44 DOMDocumentBuilderFactory factory; 45 46 DocumentBuilder builder; 47 48 protected void setUp() throws Exception { 49 super.setUp(); 50 try { 51 factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory 52 .getConfiguration2()); 53 builder = factory.getBuilder(); 54 } catch (Exception e) { 55 fail("Unexpected exception" + e.getMessage()); 56 } 57 } 58 59 protected void tearDown() throws Exception { 60 factory = null; 61 builder = null; 62 super.tearDown(); 63 } 64 65 /** 66 * Runs the test case. 67 * @throws Throwable Any uncaught exception causes test to fail 68 */ 69 // Assumes validation. 70 // public void testGetAttributeNS() throws Throwable { 71 // Document doc; 72 // Element element; 73 // String attrValue; 74 // NodeList childList; 75 // String nullNS = null; 76 // 77 // doc = (Document) load("staffNS", builder); 78 // childList = doc.getElementsByTagNameNS("http://www.nist.gov", 79 // "employee"); 80 // element = (Element) childList.item(1); 81 // attrValue = element.getAttributeNS(nullNS, "defaultAttr"); 82 // assertEquals("elementgetattributens02", "defaultVal", attrValue); 83 // } 84 85 } 86 87