String type = atts.getValue("class");
String name = atts.getValue("name");
String size = atts.getValue("length");
String pad = atts.getValue("pad");
Class c = Class.forName(type);
ISOFieldPackager f;
f = (ISOFieldPackager) c.newInstance();
f.setDescription(name);
f.setLength(Integer.parseInt(size));
f.setPad(Boolean.parseBoolean(pad));
// Insert this new isofield into the Map
// on the top of the stack using the fieldID as the key
Map m = (Map) fieldStack.peek();
m.put(new Integer(fldID), f);
}
if ( localName.equals( "isofieldvalidator" ) ){
String type = atts.getValue( "class" );
String breakOnError = atts.getValue( "break-on-error" );
String minLen = atts.getValue( "minlen" );
String maxLen = atts.getValue( "maxlen" );
Class c = Class.forName( type );
ISOFieldValidator v = (ISOFieldValidator)c.newInstance();
if ( breakOnError != null ) v.setBreakOnError(Boolean.valueOf(breakOnError));
if ( minLen != null ) v.setMinLength( Integer.parseInt( minLen ) );
if ( maxLen != null ) v.setMaxLength( Integer.parseInt( maxLen ) );
v.setFieldId( Integer.parseInt(fldID) );
/** insert validator on stack waiting for properties **/
validatorStack.push( v );
validatorStack.push( new Properties() );
}
if ( localName.equals( "property" ) ){
((Properties)validatorStack.peek()).setProperty(
atts.getValue( "name" ),
atts.getValue( "value" ) );
}
if ( localName.equals( "isovalidator" ) ){
String type = atts.getValue( "class" );
String breakOnError = atts.getValue( "break-on-error" );
Class c = Class.forName( type );
ISOBaseValidator v = (ISOBaseValidator)c.newInstance();
if ( breakOnError != null ) v.setBreakOnError(Boolean.valueOf(breakOnError));
/** insert validator on stack waiting for properties **/
validatorStack.push( v );
validatorStack.push( new Properties() );
}
if ( localName.equals("isofieldpackager") ) {
String id = atts.getValue("id");
String type = atts.getValue("class");
String name = atts.getValue("name");
String size = atts.getValue("length");
String pad = atts.getValue("pad");
/*
For a isofield packager node push the following fields
onto the stack.
1) an Integer indicating the field ID
2) an instance of the specified ISOFieldPackager class
3) an instance of the specified ISOBasePackager (msgPackager) class
4) a Map to collect the subfields
*/
String packager = atts.getValue("packager");
fieldStack.push(new Integer(id));
ISOFieldPackager f;
f = (ISOFieldPackager) Class.forName(type).newInstance();
f.setDescription(name);
f.setLength(Integer.parseInt(size));
f.setPad(Boolean.parseBoolean(pad));
fieldStack.push(f);
ISOBasePackager p;
p = (ISOBasePackager) Class.forName(packager).newInstance();
if (p instanceof GenericValidatingPackager){
GenericValidatingPackager gp = (GenericValidatingPackager) p;