Code example for Properties

Methods: get

0
            throws ParserConfigurationException,  
                   SAXException, 
                   SAXNotSupportedException { 
 
        SAXParserFactory factory =  
                        (SAXParserFactory)properties.get("SAXParserFactory");
 
        if (versionNumber == null){
            versionNumber = getXercesVersion();
            version = new Float( versionNumber ).floatValue();
        } 
 
        // Note: 2.2 is completely broken (with XML Schema).  
        if (version > 2.1) {
 
            configureXerces(factory);
            return factory.newSAXParser();
        } else { 
            SAXParser parser = factory.newSAXParser();
            configureOldXerces(parser,properties);
            return parser;
        } 
    } 
 
 
    /** 
     * Configure schema validation as recommended by the JAXP 1.2 spec. 
     * The <code>properties</code> object may contains information about 
     * the schema local and language.  
     * @param properties parser optional info 
     */ 
    private static void configureOldXerces(SAXParser parser, 
                                           Properties properties) 
            throws ParserConfigurationException,  
                   SAXNotSupportedException { 
 
        String schemaLocation = (String)properties.get("schemaLocation");
        String schemaLanguage = (String)properties.get("schemaLanguage");
 
        try{ 
            if (schemaLocation != null) {
                parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage);
                parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation);