commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Francois Arcand <jfarc...@apache.org>
Subject Re: [digester][patch] xml schema support. removal
Date Sat, 04 Oct 2003 18:26:53 GMT
Hi Robert,

robert burrell donkin wrote:

> hi Jean-Francois
>
> i'm very reluctant to apply a patch that breaks backwards 
> compatibility but i'd be happier to deprecate them. 

+1

>
>
> maybe one solution might be to refactor the setting algorithm into a 
> separate class and then have factory methods for each parse type which 
> create instances that know how to execute the required configuration. 

+1

>
>
> the current code could then be factored out allow schema support for 
> xerces 2.1. the new code you posted could form the basis of an object 
> that supports xerces 2.3/4/5 (?).
>
> 1. how does this sound? 

Sound good.  I can work on an implementation.  At least we will need one 
algorithm for Xerces 2.1 (and other jaxp schema parser), and one for 
2.3/2.4/2.5. (2.2 completely broken).

>
> 2. anyone have any better ideas? 


Will wait a couple of day before starting.

Thanks,

-- Jeanfrancois



>
>
> - robert
>
> On Thursday, October 2, 2003, at 07:47 PM, Jean-Francois Arcand wrote:
>
>> Hi,
>>
>> the current XML schema supports doesn't work with Xerces 2.3/2.4/2.5 
>> (only 2.1 finaly) (at least that's the case with Tomcat 5). The 
>> attached patch remove the current implementation. People interested 
>> to use the digester with schema/dtd should use instead:
>>
>>                    digester.setFeature(
>>                        
>> "http://apache.org/xml/features/validation/dynamic"
>> ,
>>                        true);
>>                    digester.setFeature(
>>                        
>> "http://apache.org/xml/features/validation/schema"
>> ,
>>                        true);
>>
>> when using Xerces. Other schema parser should have their own way to 
>> turn on validation. Those properties will be "standardized" in the 
>> next jaxp spec.
>>
>> A solution may also be the addition of a method called 
>> digester.turnOnSchemaValidation() that contains the above feature, 
>> but has the limitation to only works with Xerces (anybody aware of a 
>> schema parser other that Xerces?)
>>
>> Thanks,
>>
>> -- Jeanfrancois
>> Index: Digester.java
>> ===================================================================
>> RCS file: 
>> /home/cvs/jakarta-commons/digester/src/java/org/apache/commons/
>> digester/Digester.java,v
>> retrieving revision 1.81
>> diff -u -r1.81 Digester.java
>> --- Digester.java    13 Aug 2003 22:05:31 -0000    1.81
>> +++ Digester.java    2 Oct 2003 17:46:15 -0000
>> @@ -113,12 +113,11 @@
>>   * even from the same thread.</p>
>>   *
>>   * <p><strong>IMPLEMENTATION NOTE</strong> - A bug in Xerces 2.0.2

>> prevents
>> - * the support of XML schema. You need Xerces 2.1 or JAXP 1.2.1 to make
>> - * that class working with XML schema</p>
>> + * the support of XML schema. You need Xerces 2.1-2.3 and higher or
>> + * JAXP 1.2.1 to make that class working with XML schema</p>
>>   *
>>   * @author Craig McClanahan
>>   * @author Scott Sanders
>> - * @author Jean-Francois Arcand
>>   * @version $Revision: 1.81 $ $Date: 2003/08/13 22:05:31 $
>>   */
>>
>> @@ -224,20 +223,6 @@
>>       */
>>      protected SAXParserFactory factory = null;
>>
>> -
>> -    /**
>> -     * The JAXP 1.2 property required to set up the schema location.
>> -     */
>> -    private static final String JAXP_SCHEMA_SOURCE =
>> -        "http://java.sun.com/xml/jaxp/properties/schemaSource";
>> -
>> -    /**
>> -     * The JAXP 1.2 property to set up the schemaLanguage used.
>> -     */
>> -    protected String JAXP_SCHEMA_LANGUAGE =
>> -        "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
>> -
>> -
>>      /**
>>       * The Locator associated with our parser.
>>       */
>> @@ -308,19 +293,6 @@
>>       */
>>      protected Rules rules = null;
>>
>> -   /**
>> -     * The XML schema language to use for validating an XML 
>> instance. By
>> -     * default this value is set to <code>W3C_XML_SCHEMA</code>
>> -     */
>> -    protected String schemaLanguage = W3C_XML_SCHEMA;
>> -
>> -
>> -    /**
>> -     * The XML schema to use for validating an XML instance.
>> -     */
>> -    protected String schemaLocation = null;
>> -
>> -
>>      /**
>>       * The object stack being constructed.
>>       */
>> @@ -354,14 +326,6 @@
>>          LogFactory.getLog("org.apache.commons.digester.Digester.sax");
>>
>>
>> -    /**
>> -     * The schema language supported. By default, we use this one.
>> -     */
>> -    protected static final String W3C_XML_SCHEMA =
>> -        "http://www.w3.org/2001/XMLSchema";
>> -
>> -
>> -
>>      // ------------------------------------------------------------- 
>> Properties
>>
>>      /**
>> @@ -689,15 +653,6 @@
>>              return (null);
>>          }
>>
>> -        // Configure standard properties and return the new instance
>> -        try {
>> -            if (schemaLocation != null) {
>> -                setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage);
>> -                setProperty(JAXP_SCHEMA_SOURCE, schemaLocation);
>> -            }
>> -        } catch (Exception e) {
>> -            log.warn("" + e);
>> -        }
>>          return (parser);
>>
>>      }
>> @@ -798,50 +753,6 @@
>>
>>
>>      /**
>> -     * Return the XML Schema URI used for validating an XML instance.
>> -     */
>> -    public String getSchema() {
>> -
>> -        return (this.schemaLocation);
>> -
>> -    }
>> -
>> -
>> -    /**
>> -     * Set the XML Schema URI used for validating a XML Instance.
>> -     *
>> -     * @param schemaLocation a URI to the schema.
>> -     */
>> -    public void setSchema(String schemaLocation){
>> -
>> -        this.schemaLocation = schemaLocation;
>> -
>> -    }
>> -
>> -
>> -    /**
>> -     * Return the XML Schema language used when parsing.
>> -     */
>> -    public String getSchemaLanguage() {
>> -
>> -        return (this.schemaLanguage);
>> -
>> -    }
>> -
>> -
>> -    /**
>> -     * Set the XML Schema language used when parsing. By default, we 
>> use W3C.
>> -     *
>> -     * @param schemaLanguage a URI to the schema language.
>> -     */
>> -    public void setSchemaLanguage(String schemaLanguage){
>> -
>> -        this.schemaLanguage = schemaLanguage;
>> -
>> -    }
>> -
>> -
>> -    /**
>>       * Return the boolean as to whether the context classloader 
>> should be used.
>>       */
>>      public boolean getUseContextClassLoader() {
>> @@ -1399,8 +1310,8 @@
>>              entityURL = (String) entityValidator.get(publicId);
>>          }
>>
>> -        // Redirect the schema location to a local destination
>> -        if (schemaLocation != null && entityURL == null && systemId

>> != null){
>> +        // Redirect the dtd/schema location to a local destination
>> +        if (entityURL == null && systemId != null){
>>              entityURL = (String)entityValidator.get(systemId);
>>          }
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message