How do I parse an xml file and build a parse tree of caster-generated objects and get it to produce error messages a systems engineer can understand(short, with line numbers, with no reference to internals of the code such as classes), rather than:
"The following exception occured while validating field: _firstVersion of class: com.nds.castorgenericformat.AMSGenericConversionFormat: The following exception occured while validating field: _firstVersionDefTypeHeader of class: com.nds.castorgenericformat.FirstVersion: The following exception occured while validating field: _headerTypeInput of class: com.nds.castorgenericformat.FirstVersionDefTypeHeader: The following exception occured while validating field: _groupOfSTBMessageFieldDefsList of class: com.nds.castorgenericformat.HeaderTypeInput: The following exception occured while validating field: _flagsByte of class: com.nds.castorgenericformat.GroupOfSTBMessageFieldDefs: The field '_name' (whose xml name is 'name') is a required field of class 'com.nds.castorgenericformat.FlagsByte"
Which is what happens when I do:
try
{
//Set up a Unmarshaller
Unmarshaller unmarshaller = new Unmarshaller(AMSGenericConversionFormat.class);
// Build parse tree from file
AMSGenericConversionFormat genericFormat = (AMSGenericConversionFormat)unmarshaller.unmarshal(reader);
}
catch (MarshalException e1)
{
system.out.println(e1.getMessage());
}
catch (ValidationException e2)
{
system.out.println(e2.getMessage());
}
I'd rather get something like:
"error line 52 in foo.xml, attribute "name" is missing"
Thanks,
Nadav
- [castor-user] Fwd: Caster Unmarshalling Exception Handling nadav steindler
- Re: [castor-user] Fwd: Caster Unmarshalling Exception... James Abley
- Re: [castor-user] Fwd: Caster Unmarshalling Excep... nadav steindler
- Re: [castor-user] Fwd: Caster Unmarshalling E... Stephen Bash
- Re: [castor-user] Fwd: Caster Unmarshalli... Werner Guttmann
- Re: [castor-user] Fwd: Caster Unmarshalli... nadav steindler
- Re: [castor-user] Fwd: Caster Unmarshalling E... James Abley
- RE: [castor-user] Fwd: Caster Unmarshalling Exception... Werner Guttmann
- Re: [castor-user] Fwd: Caster Unmarshalling Excep... nadav steindler
- RE: [castor-user] Fwd: Caster Unmarshalling Exception... Werner Guttmann
- Re: [castor-user] Fwd: Caster Unmarshalling Excep... nadav steindler

