FileDocCategorySizeDatePackage
HCNotationsSetNamedItemNS.javaAPI DocAndroid 1.5 API3531Wed May 06 22:41:06 BST 2009tests.org.w3c.dom

HCNotationsSetNamedItemNS

public final class HCNotationsSetNamedItemNS extends DOMTestCase
An attempt to add an element to the named node map returned by notations should result in a NO_MODIFICATION_ERR or HIERARCHY_REQUEST_ERR.
author
Curt Arnold
see
http://www.w3.org/TR/DOM-Level-2-Core/core#ID-D46829EF
see
http://www.w3.org/TR/DOM-Level-2-Core/core#ID-setNamedItemNS

Fields Summary
DOMDocumentBuilderFactory
factory
DocumentBuilder
builder
Constructors Summary
Methods Summary
protected voidsetUp()

        super.setUp();
        try {
            factory = new DOMDocumentBuilderFactory(DOMDocumentBuilderFactory
                    .getConfiguration1());
            builder = factory.getBuilder();
        } catch (Exception e) {
            fail("Unexpected exception" + e.getMessage());
        }
    
protected voidtearDown()

        factory = null;
        builder = null;
        super.tearDown();
    
public voidtestNotationsSetNamedItemNS()
Runs the test case.

throws
Throwable Any uncaught exception causes test to fail

        Document doc;
        NamedNodeMap notations;
        DocumentType docType;

        Element elem;
        doc = (Document) load("hc_staff", builder);
        docType = doc.getDoctype();

        if (!(("text/html".equals(getContentType())))) {
            assertNotNull("docTypeNotNull", docType);
            notations = docType.getNotations();
            assertNotNull("notationsNotNull", notations);
            elem = doc.createElementNS("http://www.w3.org/1999/xhtml", "br");

            try {
                notations.setNamedItemNS(elem);
                fail("throw_HIER_OR_NO_MOD_ERR");

            } catch (DOMException ex) {
                switch (ex.code) {
                case 3:
                    break;
                case 7:
                    break;
                default:
                    throw ex;
                }
            }
        }