< prev index next >

test/javax/xml/jaxp/functional/org/w3c/dom/ptests/NotationTest.java

Print this page




  57      * Test getPublicId method.
  58      */
  59     @Test
  60     public void testGetPublicId() throws Exception {
  61         assertEquals(findNotation("pubname").getPublicId(), "pubId");
  62     }
  63 
  64     //find notation in Notation01.xml
  65     private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
  66         Document document = createDOM("Notation01.xml");
  67         NamedNodeMap nm = document.getDoctype().getNotations();
  68         for (int i = 0; i < nm.getLength(); i++) {
  69             if (nm.item(i).getNodeName().equals(name)) {
  70                 return (Notation) nm.item(i);
  71             }
  72         }
  73         throw new RuntimeException("Notation: '" + name + "' not found.");
  74     }
  75 
  76 }
  77 


  57      * Test getPublicId method.
  58      */
  59     @Test
  60     public void testGetPublicId() throws Exception {
  61         assertEquals(findNotation("pubname").getPublicId(), "pubId");
  62     }
  63 
  64     //find notation in Notation01.xml
  65     private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
  66         Document document = createDOM("Notation01.xml");
  67         NamedNodeMap nm = document.getDoctype().getNotations();
  68         for (int i = 0; i < nm.getLength(); i++) {
  69             if (nm.item(i).getNodeName().equals(name)) {
  70                 return (Notation) nm.item(i);
  71             }
  72         }
  73         throw new RuntimeException("Notation: '" + name + "' not found.");
  74     }
  75 
  76 }

< prev index next >