Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 59842 invoked from network); 4 Oct 2003 13:14:49 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Oct 2003 13:14:49 -0000 Received: (qmail 95468 invoked by uid 500); 4 Oct 2003 13:14:42 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 95355 invoked by uid 500); 4 Oct 2003 13:14:42 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 95327 invoked from network); 4 Oct 2003 13:14:41 -0000 Received: from unknown (HELO smtp-out3.blueyonder.co.uk) (195.188.213.6) by daedalus.apache.org with SMTP; 4 Oct 2003 13:14:41 -0000 Received: from localhost ([82.38.66.131]) by smtp-out3.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.5600); Sat, 4 Oct 2003 14:14:41 +0100 Date: Sat, 4 Oct 2003 14:16:58 +0100 Subject: Re: [digester][patch] xml schema support. removal Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) From: robert burrell donkin To: "Jakarta Commons Developers List" Content-Transfer-Encoding: 7bit In-Reply-To: <3F7C72AC.7040106@apache.org> Message-Id: <08899529-F66D-11D7-82A0-003065DC754C@blueyonder.co.uk> X-Mailer: Apple Mail (2.482) X-OriginalArrivalTime: 04 Oct 2003 13:14:41.0444 (UTC) FILETIME=[78893640:01C38A79] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hi Jean-Francois i'm very reluctant to apply a patch that breaks backwards compatibility but i'd be happier to deprecate them. 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. 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? 2. anyone have any better ideas? - 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.

> * > *

IMPLEMENTATION NOTE - 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

> + * 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

> * > * @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 W3C_XML_SCHEMA > - */ > - 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