/**
   * Runs the test case.
   *
   * @throws Throwable Any uncaught exception causes test to fail
   */
  public void runTest() throws Throwable {
    Document doc;
    NamedNodeMap notations;
    DocumentType docType;
    Node retval;
    Element elem;
    doc = (Document) load("hc_staff", true);
    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 {
        retval = 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;
        }
      }
    }
  }
Ejemplo n.º 2
0
 /**
  * Runs the test case.
  *
  * @throws Throwable Any uncaught exception causes test to fail
  */
 public void runTest() throws Throwable {
   Document doc;
   DocumentType docType;
   NamedNodeMap entitiesMap;
   Entity entity;
   String encodingName;
   doc = (Document) load("external_barfoo", false);
   docType = doc.getDoctype();
   entitiesMap = docType.getEntities();
   entity = (Entity) entitiesMap.getNamedItem("ent5");
   encodingName = entity.getXmlEncoding();
   assertNull("entitygetxmlencoding02", encodingName);
 }
Ejemplo n.º 3
0
  /**
   * Runs the test case.
   *
   * @throws Throwable Any uncaught exception causes test to fail
   */
  public void runTest() throws Throwable {
    Document doc;
    DocumentType docType;
    Entity entity;
    NamedNodeMap entitymap;
    String textContent;
    doc = (Document) load("hc_staff", true);
    docType = doc.getDoctype();
    entitymap = docType.getEntities();
    entity = (Entity) entitymap.getNamedItem("delta");

    {
      boolean success = false;
      try {
        entity.setTextContent("NA");
      } catch (DOMException ex) {
        success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
      }
      assertTrue("nodesettextcontent13", success);
    }
  }
  /**
   * Runs the test case.
   *
   * @throws Throwable Any uncaught exception causes test to fail
   */
  public void runTest() throws Throwable {
    Document doc;
    DocumentType docType;
    NamedNodeMap entities;
    NamedNodeMap notations;
    Entity entity;
    Notation notation;
    Node newNode;
    String nullNS = null;

    doc = (Document) load("staffNS", true);
    docType = doc.getDoctype();
    entities = docType.getEntities();
    assertNotNull("entitiesNotNull", entities);
    notations = docType.getNotations();
    assertNotNull("notationsNotNull", notations);
    entity = (Entity) entities.getNamedItem("ent1");
    notation = (Notation) notations.getNamedItem("notation1");

    {
      boolean success = false;
      try {
        newNode = entities.setNamedItemNS(entity);
      } catch (DOMException ex) {
        success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
      }
      assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities", success);
    }

    {
      boolean success = false;
      try {
        newNode = notations.setNamedItemNS(notation);
      } catch (DOMException ex) {
        success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
      }
      assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success);
    }
  }