Community
Participate
Working Groups
When an XML Schema is set on Marshaller, the Marshaller should perform validation based on that schema during the marshal operation. Currently this is not supported.
I think the same problem is present in the unmarshaller. I am not able to validate an xml file. Digging into the source code I have found the following in the initialize() method of the class org.eclipse.persistence.oxm.XMLUnmarshaller // Waiting on XDK to fix bug #3697940 to enable this code //initializeSchemas(); setValidationMode(NONVALIDATING); Unfornately any bug with id #3697940 is present in bugzilla. Is this feature in development? if yes, when is the expected release date? Thanks, Fabrizio
I have opened the following bug for the unmarshal issue: - https://bugs.eclipse.org/bugs/show_bug.cgi?id=329398 I believe I have the fix (see attachments on bug), but I still need to do more formal testing tomorrow.
Created attachment 182667 [details] Core - Fix
Created attachment 182668 [details] MOXy - Fix
Created attachment 182847 [details] MOXy - Test Cases
Created attachment 182849 [details] Core - Fix
Created attachment 182850 [details] MOXy - Fix
Fix checked into trunk at rev: 8492 Code reviewed by: Matt MacIvor Core Fix: - Create a new class called ValidatingMarshalRecord. This class wraps a MarshalRecord and a ContentHandlerRecord that delegates calls to a ValidatorHandler. - Added an ErrorHandler property to xmlmarshaller/CustomErrorValidationEventHandler.java MOXy Fix: - Similar to what we do in JAXBUnmarshaller, the JAXBMarshaller now sets a JAXBErrorHandler on the underlying XMLMarshaller. MOXy Test Cases: - Added some tests specifically to handle schema validation. - Added a new marshal test to XMLMappingTestCases that runs all the child tests using a ValidatingMarshalRecord.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink