예제 #1
0
 /**
  * Override SAXParser's setFeature method to track the initial state of features. This keeps us
  * from affecting the performance of the SAXParser when it is created with XMLReaderFactory.
  */
 public synchronized void setFeature(String name, boolean value)
     throws SAXNotRecognizedException, SAXNotSupportedException {
   if (name == null) {
     // TODO: Add localized error message.
     throw new NullPointerException();
   }
   if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
     try {
       fSecurityManager.setSecureProcessing(value);
       setProperty(SECURITY_MANAGER, fSecurityManager);
     } catch (SAXNotRecognizedException exc) {
       // If the property is not supported
       // re-throw the exception if the value is true.
       if (value) {
         throw exc;
       }
     } catch (SAXNotSupportedException exc) {
       // If the property is not supported
       // re-throw the exception if the value is true.
       if (value) {
         throw exc;
       }
     }
     return;
   }
   if (!fInitFeatures.containsKey(name)) {
     boolean current = super.getFeature(name);
     fInitFeatures.put(name, current ? Boolean.TRUE : Boolean.FALSE);
   }
   /** Forward feature to the schema validator if there is one. * */
   if (fSAXParser != null && fSAXParser.fSchemaValidator != null) {
     setSchemaValidatorFeature(name, value);
   }
   super.setFeature(name, value);
 }
예제 #2
0
 synchronized void restoreInitState()
     throws SAXNotRecognizedException, SAXNotSupportedException {
   Iterator iter;
   if (!fInitFeatures.isEmpty()) {
     iter = fInitFeatures.entrySet().iterator();
     while (iter.hasNext()) {
       Map.Entry entry = (Map.Entry) iter.next();
       String name = (String) entry.getKey();
       boolean value = ((Boolean) entry.getValue()).booleanValue();
       super.setFeature(name, value);
     }
     fInitFeatures.clear();
   }
   if (!fInitProperties.isEmpty()) {
     iter = fInitProperties.entrySet().iterator();
     while (iter.hasNext()) {
       Map.Entry entry = (Map.Entry) iter.next();
       String name = (String) entry.getKey();
       Object value = entry.getValue();
       super.setProperty(name, value);
     }
     fInitProperties.clear();
   }
 }
예제 #3
0
 void setFeature0(String name, boolean value)
     throws SAXNotRecognizedException, SAXNotSupportedException {
   super.setFeature(name, value);
 }