Return-Path: Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 59806 invoked from network); 28 Apr 2003 14:45:09 -0000 Received: from mail021.syd.optusnet.com.au (210.49.20.161) by daedalus.apache.org with SMTP; 28 Apr 2003 14:45:09 -0000 Received: from walding.com (c18722.rochd1.qld.optusnet.com.au [198.142.49.64]) by mail021.syd.optusnet.com.au (8.11.6p2/8.11.6) with ESMTP id h3SEjAg30577 for ; Tue, 29 Apr 2003 00:45:11 +1000 Message-ID: <3EAD3E6D.2070508@walding.com> Date: Tue, 29 Apr 2003 00:45:01 +1000 From: Ben Walding User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jakarta Commons Users List Subject: Re: [digester] Parsing a schema instance / parsing dates References: <3EAD3CF7.4040103@iqnex.com> In-Reply-To: <3EAD3CF7.4040103@iqnex.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N For errors to be thrown you need to set the errorhandler on the digester d.setErrorHandler(new ErrorHandler() { public void warning(SAXParseException exception) throws SAXException { //System.out.println("Warning: " + exception.toString()); throw new DataForgeRuntimeException(exception); } public void error(SAXParseException exception) throws SAXException { //System.out.println("Error: " + exception.toString()); throw new DataForgeRuntimeException(exception); } public void fatalError(SAXParseException exception) throws SAXException { System.out.println("Fatal: " + exception.toString()); } }); Karol R�ckschloss wrote: > Hello, > > I have used Digester for the last couple of weeks but never validated > against a schema before. > > Now I'm in a situation where I want to make Digester respect a schema > during the parsing. More specific, there are date fields in the XML > documents that I'm parsing with Digester. > ... > 2003-28-04 > ... > What I tried to do is to > digester.setSchema(...); > digester.setValidating(true); > > However, even if I put an invalid date in the , Digester is > still happy about it. I would actually want an exception to be thrown. > The setSchema(String) call doesn't seem to have any effect. Am I doing > something wrong? > > Another point with the dates. It would be excellent if Digester could > recognize elements with type="xs:date" and accept a CallMethodRule, > such as > digester.addCallMethod( > "root/startDate", > "setStartDate", > 0, > new Class[] { Date.class }); > Currently, this throws an ugly exception during the parsing because > Digester doesn't realize that 2003-28-04 is a date... > > Any help will be mostly appreciated. > > KarolR > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: commons-user-help@jakarta.apache.org > >