/**
   * Check a property. If the property is know and supported, this method simply returns. Otherwise,
   * the appropriate exception is thrown.
   *
   * @param propertyId The unique identifier (URI) of the property being set.
   * @throws XMLConfigurationException Thrown for configuration error. In general, components should
   *     only throw this exception if it is <strong>really</strong> a critical error.
   */
  protected void checkProperty(String propertyId) throws XMLConfigurationException {

    //
    // Xerces Properties
    //

    if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
      final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();

      if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length()
          && propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
        return;
      }
    }

    if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
      final int suffixLength = propertyId.length() - Constants.JAXP_PROPERTY_PREFIX.length();

      if (suffixLength == Constants.SCHEMA_SOURCE.length()
          && propertyId.endsWith(Constants.SCHEMA_SOURCE)) {
        return;
      }
    }

    //
    // Not recognized
    //

    super.checkProperty(propertyId);
  } // checkProperty(String)
Esempio n. 2
0
  /**
   * Check a property. If the property is know and supported, this method simply returns. Otherwise,
   * the appropriate exception is thrown.
   *
   * @param propertyId The unique identifier (URI) of the property being set.
   * @throws XMLConfigurationException Thrown for configuration error. In general, components should
   *     only throw this exception if it is <strong>really</strong> a critical error.
   */
  protected void checkProperty(String propertyId) throws XMLConfigurationException {

    //
    // Xerces Properties
    //

    if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
      final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();

      if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length()
          && propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
        return;
      }
    }

    // special cases
    if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
      final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();

      //
      // http://xml.org/sax/properties/xml-string
      // Value type: String
      // Access: read-only
      //   Get the literal string of characters associated with the
      //   current event.  If the parser recognises and supports this
      //   property but is not currently parsing text, it should return
      //   null (this is a good way to check for availability before the
      //   parse begins).
      //
      if (suffixLength == Constants.XML_STRING_PROPERTY.length()
          && propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
        // REVISIT - we should probably ask xml-dev for a precise
        // definition of what this is actually supposed to return, and
        // in exactly which circumstances.
        short type = XMLConfigurationException.NOT_SUPPORTED;
        throw new XMLConfigurationException(type, propertyId);
      }
    }

    //
    // Not recognized
    //

    super.checkProperty(propertyId);
  } // checkProperty(String)