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

HCNotationsRemoveNamedItemNS

public final class HCNotationsRemoveNamedItemNS extends DOMTestCase
An attempt to add remove an notation using removeNamedItemNS should result in a NO_MODIFICATION_ERR or a NOT_FOUND_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-removeNamedItemNS

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 voidtestRemoveNamedItemNS()
Runs the test case.

throws
Throwable Any uncaught exception causes test to fail

        Document doc;
        NamedNodeMap notations;
        DocumentType docType;

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

        if (!(("text/html".equals(getContentType())))) {
            assertNotNull("docTypeNotNull", docType);
            notations = docType.getNotations();
            assertNotNull("notationsNotNull", notations);

            try {
                notations.removeNamedItemNS("http://www.w3.org/1999/xhtml",
                        "alpha");
                fail("throw_NO_MOD_OR_NOT_FOUND_ERR");

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