예제 #1
0
  /**
   * Set the state of a feature.
   *
   * <p>Set the state of any feature in a SAX2 parser. The parser might not recognize the feature,
   * and if it does recognize it, it might not be able to fulfill the request.
   *
   * @param featureId The unique identifier (URI) of the feature.
   * @param state The requested state of the feature (true or false).
   * @exception org.apache.xerces.xni.parser.XMLConfigurationException If the requested feature is
   *     not known.
   */
  public void setFeature(String featureId, boolean state) throws XMLConfigurationException {
    fConfigUpdated = true;
    // forward to every XML 1.0 component
    int count = fComponents.size();
    for (int i = 0; i < count; i++) {
      XMLComponent c = (XMLComponent) fComponents.get(i);
      c.setFeature(featureId, state);
    }
    // forward it to common components
    count = fCommonComponents.size();
    for (int i = 0; i < count; i++) {
      XMLComponent c = (XMLComponent) fCommonComponents.get(i);
      c.setFeature(featureId, state);
    }

    // forward to every XML 1.1 component
    count = fXML11Components.size();
    for (int i = 0; i < count; i++) {
      XMLComponent c = (XMLComponent) fXML11Components.get(i);
      try {
        c.setFeature(featureId, state);
      } catch (Exception e) {
        // no op
      }
    }
    // save state if noone "objects"
    super.setFeature(featureId, state);
  } // setFeature(String,boolean)