Best code examples for Java 8 SAXParserFactory class (javax.xml.parsers.SAXParserFactory)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SAXParserFactory class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 SAXParserFactory examples from Open Source projects
This code example shows how to use the following methods: newSAXParser, setNamespaceAware, setValidating, setXIncludeAware
  private XMLReader getXMLReader()
    throws LSException 
  { 
    if (reader == null)
      { 
        factory.setNamespaceAware(namespaceAware);
        factory.setValidating(validating);
        factory.setXIncludeAware(xIncludeAware);
        try 
          { 
            SAXParser parser = factory.newSAXParser();
            reader = parser.getXMLReader();
          } 
        catch (ParserConfigurationException e)
          { 
            throw new DomLSException(LSException.PARSE_ERR, e);
          } 
        catch (SAXException e)
          { 
            throw new DomLSException(LSException.PARSE_ERR, e);
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: newSAXParser, setFeature
   { 
       try 
       { 
          SAXParserFactory spf = SAXParserFactory.newInstance();
          configureParserFactory(spf);
          SAXParser sp = spf.newSAXParser();
          XMLReader xmlReader = sp.getXMLReader();
          SAXSource saxSource = new SAXSource(xmlReader, source);
          return delegate.unmarshal(saxSource);
      } 
      catch (SAXException e)
      { 
         throw new JAXBException(e);
      } 
      catch (ParserConfigurationException e)
      { 
         throw new JAXBException(e);
      } 
   } 
 

7
CodeRank
This code example shows how to use the following methods: newSAXParser, setFeature, setNamespaceAware, setValidating
		// SAX2 namespace-prefixes should be true for either builder 
		setSafeFeature(fty, "http://xml.org/sax/features/namespace-prefixes", true);
 
		// Set SAX2 namespaces feature appropriately 
		setSafeFeature(fty, "http://xml.org/sax/features/namespaces", nsaware);
		fty.setNamespaceAware(nsaware);
 
		setSafeFeature(fty, "http://xml.org/sax/features/validation", validate);
		setSafeFeature(fty, "http://apache.org/xml/features/validation/schema", validate);
		fty.setValidating(validate);
 
		_parser = fty.newSAXParser();
	} 
	private static 
	void setSafeFeature(SAXParserFactory fty, String feature, boolean value) {
		try { 
			fty.setFeature(feature, value);
		} catch (Throwable ex) {
			//IGNORE IT (crimson doesn't support ...validation/schema) 
			if (feature.startsWith("http://xml.org"))

7
CodeRank
This code example shows how to use the following methods: setNamespaceAware
    @Override 
    @PerThread 
    public SAXParserFactory provide() {
        SAXParserFactory factory = SAXParserFactory.newInstance();
 
        factory.setNamespaceAware(true);
 
        if (!isXmlSecurityDisabled()) { 
            factory = new SecureSaxParserFactory(factory);
        } 
 
        return factory;
    } 
 
    @Override 
    public void dispose(SAXParserFactory instance) {
        //not used 
    } 
} 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setFeature, setNamespaceAware, setValidating
	private CmsEntityDeserialization(){ 
		try{ 
			 
			saxParserFactory = SAXParserFactory.newInstance();
			 
			saxParserFactory.setNamespaceAware(true);
			saxParserFactory.setValidating(false);
			 
			saxParserFactory.setFeature("http://apache.org/xml/features/validation/schema",true);
			saxParserFactory.setFeature("http://xml.org/sax/features/validation", true);
			saxParserFactory.setFeature("http://xml.org/sax/features/namespaces",true);
			//saxParserFactory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); 
			 
			/* 
			 *  
			 * A true value for this feature allows the encoding of the file to be specified as a  
			 * Java encoding name as well as the standard ISO encoding name. Be aware that other  
			 * parsers may not be able to use Java encoding names. If this feature is set to false,  
			 * an error will be generated if Java encoding names are used.   
			 */ 

7
CodeRank
Related Java 8 SAXParserFactory Questions & Answers:
See Code Examples for Java 8 SAXParserFactory Methods: