< prev index next >

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

Print this page




  53             // create and initialize the parser
  54             SAXParserFactory spf = SAXParserFactory.newInstance();
  55             spf.setNamespaceAware(true);
  56             spf.setValidating(true);
  57 
  58             SAXParser parser = spf.newSAXParser();
  59             parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
  60 
  61             File xmlFile = new File(getClass().getResource(XML_FILE_NAME).getPath());
  62 
  63             parser.parse(xmlFile, new DefaultHandler());
  64         } catch (Exception e) {
  65             System.err.println("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
  66             e.printStackTrace();
  67             Assert.fail("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.  " + e.getMessage());
  68         }
  69 
  70         System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
  71     }
  72 }
  73 


  53             // create and initialize the parser
  54             SAXParserFactory spf = SAXParserFactory.newInstance();
  55             spf.setNamespaceAware(true);
  56             spf.setValidating(true);
  57 
  58             SAXParser parser = spf.newSAXParser();
  59             parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
  60 
  61             File xmlFile = new File(getClass().getResource(XML_FILE_NAME).getPath());
  62 
  63             parser.parse(xmlFile, new DefaultHandler());
  64         } catch (Exception e) {
  65             System.err.println("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
  66             e.printStackTrace();
  67             Assert.fail("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.  " + e.getMessage());
  68         }
  69 
  70         System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
  71     }
  72 }

< prev index next >