Eek! I retract everything I said, it really probably is something we can control in Castor. Patty, can you do a quick search in Jira to make sure this issue doesn't already exist, and then create one so we can keep track of the progress on the issue?
Thanks, Stephen On 3/23/06, Stephen Bash <[EMAIL PROTECTED]> wrote: > Patty- > > I'm not 100% sure, but I think this is really a parser issue. I think > validation errors look like normal SAXExceptions to Castor, so there > isn't really a way to recover... But I'd be happy to be corrected. > With that in mind, one parser feature you can look into is the > following: > > http://apache.org/xml/features/continue-after-fatal-error > > Unfortunately on the Xerces website, the following warning is attached: > > "The behavior of the parser when this feature is set to true is > undetermined! Therefore use this feature with extreme caution because > the parser may get stuck in an infinite loop or worse." > > This is actually a fairly regularly requested feature, so please let > us know if you find something that does the trick. > > Stephen > > On 3/22/06, Parker, Patricia (Contr) <[EMAIL PROTECTED]> wrote: > > > > > > Hi > > > > I would like to validate my entire instance document against an XML schema > > during the unmarshalling process and accumulate all the validation > > exceptions so that I may send them back to the document creator so they may > > all be fixed. Right now, Castor is throwing the first ValidationException > > and stopping the schema validation process. Is there a way to tell Castor > > to validate the entire document before stopping (i.e. make a > > ValidationException a non-fatal error)? > > > > My Castor driver method: > > > > //unmarshal xml > > boolean isSuccessful = true; > > > > Reader toParse = new StringReader((String) xmlToParse); > > > > try > > { > > Mapping mapping = new Mapping(); > > mapping.loadMapping(mapFileName); > > Unmarshaller un = new Unmarshaller(castorClass); > > un.setMapping(mapping ); > > un.setWhitespacePreserve(true); > > un.setValidation(true); > > try > > { > > castorVO = (AbstractCastorVO) > > un.unmarshal(toParse); > > } > > catch (ValidationException ex) > > { > > parserMessageList.add(ex.getMessage()); > > } > > catch(MarshalException ex) > > { > > parserMessageList.add(ex.getMessage()); > > } > > > > toParse.close(); > > } > > > > catch (IOException ex) > > { > > isSuccessful = false; > > parserMessageList.add(ex.getMessage()); > > } > > catch (MappingException ex) > > { > > isSuccessful = false; > > parserMessageList.add(ex.getMessage()); > > } > > catch (MarshalException ex) > > { > > isSuccessful = false; > > parserMessageList.add(ex.getMessage()); > > } > > > > return isSuccessful; > > > > > > My castor.properties settings: > > > > # True if xml documents should be validated by the SAX Parser > > # > > org.exolab.castor.parser.validation=true > > > > # Per Patty - set to false when generating code > > # then set to true for un/marshalling > > org.exolab.castor.parser.namespaces=true > > > > > > # True if all documents should be validated by the marshalling framework > > # > > org.exolab.castor.marshalling.validation=true > > org.exolab.castor.unmarshalling.validation=true > > > > org.exolab.castor.sax.features=http://xml.org/sax/features/validation,\ > > http://apache.org/xml/features/validation/schema,\ > > > > http://apache.org/xml/features/validation/schema-full-checking > > > > # Comma separated list of SAX 2 features that should be enabled > > # for the default parser. > > # > > #org.exolab.castor.features= > > > > Thank you for your help > > > > Patty >

