Index: main/java/org/exolab/castor/xml/UnmarshalHandler.java =================================================================== --- main/java/org/exolab/castor/xml/UnmarshalHandler.java (Revision 6978) +++ main/java/org/exolab/castor/xml/UnmarshalHandler.java (Arbeitskopie) @@ -897,7 +897,9 @@ context.setResolver(_cdResolver); context.setConfiguration(_config); validator.validate(state.object, context); - validator.checkUnresolvedIdrefs(context); + if (!_config.getLenientIdValidation()) { + validator.checkUnresolvedIdrefs(context); + } context.cleanup(); } catch(ValidationException vEx) { @@ -2940,7 +2942,7 @@ if (classDesc.getIdentity() == descriptor) { try { - _idResolver.bind(attValue, parent, isValidating()); + _idResolver.bind(attValue, parent, isValidating() && !_config.getLenientIdValidation()); } catch (ValidationException e) { throw new SAXException("Duplicate ID " + attValue + " encountered.", e); } Index: main/java/org/exolab/castor/util/Configuration.java =================================================================== --- main/java/org/exolab/castor/util/Configuration.java (Revision 6978) +++ main/java/org/exolab/castor/util/Configuration.java (Arbeitskopie) @@ -289,6 +289,15 @@ */ public static final String LenientSequenceOrder = "org.exolab.castor.xml.lenient.sequence.order"; + /** + * Property specifying whether id/href validation should be lenient; + * defaults to false + *
+         * org.exolab.castor.xml.lenient.id.validation=false
+         * 
+ */ + public static final String LenientIdValidation = "org.exolab.castor.xml.lenient.id.validation"; + } //-- class: Property @@ -540,7 +549,7 @@ public static boolean getDefaultLenientSequenceOrder() { return Boolean.valueOf(_defaultProps.getProperty(Property.LenientSequenceOrder, "false")).booleanValue(); - } //-- getDefaultParser + } /** * Indicates whether sequence order validation is lenient. @@ -554,8 +563,32 @@ public boolean getLenientSequenceOrder() { return getDefaultLenientSequenceOrder(); } //-- getParser - + /** + * Indicates whether (by default) id/href validation is lenient. + * + * @return True if id/href validation is lenient. + * @see #getLenientIdValidation() + */ + public static boolean getDefaultLenientIdValidation() + { + return Boolean.valueOf(_defaultProps.getProperty(Property.LenientIdValidation, "false")).booleanValue(); + } + + /** + * Indicates whether id/href validation is lenient. + * + * Design note: This method should be overloaded by any + * sub-classes. + * + * @return True if id/href validation is lenient. + * @see #getDefaultLenientIdValidation() + */ + public boolean getLenientIdValidation() { + return getDefaultLenientIdValidation(); + } + + /** * Return an XML document parser implementing the feature list * specified in the default configuration file. * Index: main/java/org/exolab/castor/util/LocalConfiguration.java =================================================================== --- main/java/org/exolab/castor/util/LocalConfiguration.java (Revision 6978) +++ main/java/org/exolab/castor/util/LocalConfiguration.java (Arbeitskopie) @@ -590,8 +590,17 @@ public boolean getLenientSequenceOrder() { return Boolean.valueOf(getProperties().getProperty(Property.LenientSequenceOrder, "false")).booleanValue(); - } //-- getDefaultParser + } + /** + * Indicates whether id/href validation should be lenient. + * + * @return True if id/href validation should be lenient. + */ + public boolean getLenientIdValidation() + { + return Boolean.valueOf(getProperties().getProperty(Property.LenientIdValidation, "false")).booleanValue(); + } /** * Calls {@link #getDefault()} to load the configuration the Index: main/resources/org/exolab/castor/castor.properties =================================================================== --- main/resources/org/exolab/castor/castor.properties (Revision 6978) +++ main/resources/org/exolab/castor/castor.properties (Arbeitskopie) @@ -240,3 +240,8 @@ # defaults to false org.exolab.castor.xml.lenient.sequence.order=false +# +# Property specifying whether id/href validation should be lenient; +# defaults to false +org.exolab.castor.xml.lenient.id.validation=false + \ Kein Zeilenvorschub am Ende der Datei