Move to Android N-MR1 SDK.
[android_tools.git] / sdk / sources / android-25 / org / w3c / domts / level1 / core / namednodemapreturnattrnode.java
blob92d7a409d797e86245b33cee13794d4801590eb1
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:
8 Copyright (c) 2001 World Wide Web Consortium,
9 (Massachusetts Institute of Technology, Institut National de
10 Recherche en Informatique et en Automatique, Keio University). All
11 Rights Reserved. This program is distributed under the W3C's Software
12 Intellectual Property License. This program is distributed in the
13 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE.
16 See W3C License http://www.w3.org/Consortium/Legal/ for more details.
20 package org.w3c.domts.level1.core;
22 import org.w3c.dom.*;
25 import org.w3c.domts.DOMTestCase;
26 import org.w3c.domts.DOMTestDocumentBuilderFactory;
30 /**
31 * The "getNamedItem(name)" method returns a node of any
32 * type specified by name.
34 * Retrieve the second employee and create a NamedNodeMap
35 * listing of the attributes of the last child. Once the
36 * list is created an invocation of the "getNamedItem(name)"
37 * method is done with name="street". This should result
38 * in the method returning an Attr node.
39 * @author NIST
40 * @author Mary Brady
41 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1074577549</a>
42 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-84CF096</a>
43 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-637646024</a>
44 * @see <a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1112119403</a>
46 public final class namednodemapreturnattrnode extends DOMTestCase {
48 /**
49 * Constructor.
50 * @param factory document factory, may not be null
51 * @throws org.w3c.domts.DOMTestIncompatibleException Thrown if test is not compatible with parser configuration
53 public namednodemapreturnattrnode(final DOMTestDocumentBuilderFactory factory) throws org.w3c.domts.DOMTestIncompatibleException {
54 super(factory);
57 // check if loaded documents are supported for content type
59 String contentType = getContentType();
60 preload(contentType, "staff", false);
63 /**
64 * Runs the test case.
65 * @throws Throwable Any uncaught exception causes test to fail
67 public void runTest() throws Throwable {
68 Document doc;
69 NodeList elementList;
70 Node testEmployee;
71 NamedNodeMap attributes;
72 Node streetAttr;
73 String attrName;
74 doc = (Document) load("staff", false);
75 elementList = doc.getElementsByTagName("address");
76 testEmployee = elementList.item(1);
77 attributes = testEmployee.getAttributes();
78 streetAttr = attributes.getNamedItem("street");
79 assertInstanceOf("typeAssert", Attr.class, streetAttr);
80 attrName = streetAttr.getNodeName();
81 assertEquals("nodeName", "street", attrName);
82 attrName = ((Attr) /*Node */streetAttr).getName();
83 assertEquals("attrName", "street", attrName);
85 /**
86 * Gets URI that identifies the test.
87 * @return uri identifier of test
89 public String getTargetURI() {
90 return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/namednodemapreturnattrnode";
92 /**
93 * Runs this test from the command line.
94 * @param args command line arguments
96 public static void main(final String[] args) {
97 DOMTestCase.doMain(namednodemapreturnattrnode.class, args);