[Design of JBossXB] - Re: How to force strict validation?
by rob.stryker@jboss.com
Ok... well... for writing a file, it's obvious to me that JBoss XB cannot validate the object conforms to schema until either a) its done marshalling the object, or b) doing it while serializing.
I'm currently using XercesXSMarshaller to serialize my object, and after tracing through, it doesn't seem to check any data structure at all to see if any required attributes are missing.
I notice that around line 492 in XercesXSMarshaller, it gets a list of attributes that can be there, but after browsing that data structure in eclipse's debugger, I don't see any reference to whether that attribute is optional or required.
if I were able to find which data structure in xerces holds that critical information, I could provide either a patch or a new class (ValidatingXercesXSMarshaller?) that would be able to validate while marshalling the object (or throw an XB Exception if it were to fail validation.)
Is this reasonable? I think it seems like a good idea to have a marshaller that can validate while marshalling or throw an exception upon failure.
Otherwise, I'd most likely need to force my GenericObjectModelProvider implementation do the validation itself inside the getAttributeValue(etc) method, which would then need to be manually changed if the schema were to change.
Thoughts?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133045#4133045
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133045
16 years, 8 months