< prev index next >

test/javax/xml/jaxp/unittest/parsers/Bug4934208.java

Print this page




  57         } catch (SAXException e) {
  58             Assert.assertTrue(e.getMessage().startsWith("cvc-complex-type.2.4.a"));
  59         }
  60     }
  61 
  62     private void parse(InputSource is) throws Exception {
  63         SAXParserFactory spf = SAXParserFactory.newInstance();
  64         spf.setNamespaceAware(true);
  65         spf.setValidating(true);
  66         SAXParser parser = spf.newSAXParser();
  67 
  68         parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
  69         parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", Bug4934208.class.getResourceAsStream("test.xsd"));
  70 
  71         XMLReader r = parser.getXMLReader();
  72 
  73         r.setErrorHandler(new DraconianErrorHandler());
  74         r.parse(is);
  75     }
  76 }
  77 


  57         } catch (SAXException e) {
  58             Assert.assertTrue(e.getMessage().startsWith("cvc-complex-type.2.4.a"));
  59         }
  60     }
  61 
  62     private void parse(InputSource is) throws Exception {
  63         SAXParserFactory spf = SAXParserFactory.newInstance();
  64         spf.setNamespaceAware(true);
  65         spf.setValidating(true);
  66         SAXParser parser = spf.newSAXParser();
  67 
  68         parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
  69         parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", Bug4934208.class.getResourceAsStream("test.xsd"));
  70 
  71         XMLReader r = parser.getXMLReader();
  72 
  73         r.setErrorHandler(new DraconianErrorHandler());
  74         r.parse(is);
  75     }
  76 }

< prev index next >