< prev index next >

test/javax/xml/jaxp/unittest/dom/Bug4966143.java

Print this page




  49 
  50     @Test
  51     public void test1() throws Exception {
  52         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  53         dbf.setNamespaceAware(true);
  54         dbf.setValidating(true);
  55         dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
  56         dbf.setAttribute(SCHEMA_SOURCE, Bug4966143.class.getResource("Bug4966143.xsd").toExternalForm());
  57 
  58         Document document = dbf.newDocumentBuilder().parse(Bug4966143.class.getResource("Bug4966143.xml").toExternalForm());
  59 
  60         TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
  61 
  62         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
  63         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_LIST));
  64         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_RESTRICTION));
  65         Assert.assertTrue(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_EXTENSION));
  66         Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
  67     }
  68 }
  69 


  49 
  50     @Test
  51     public void test1() throws Exception {
  52         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  53         dbf.setNamespaceAware(true);
  54         dbf.setValidating(true);
  55         dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
  56         dbf.setAttribute(SCHEMA_SOURCE, Bug4966143.class.getResource("Bug4966143.xsd").toExternalForm());
  57 
  58         Document document = dbf.newDocumentBuilder().parse(Bug4966143.class.getResource("Bug4966143.xml").toExternalForm());
  59 
  60         TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
  61 
  62         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
  63         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_LIST));
  64         Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_RESTRICTION));
  65         Assert.assertTrue(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_EXTENSION));
  66         Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
  67     }
  68 }

< prev index next >