handler.characters(temp, 0, temp.length);
handler.endElement(Constants.MARCXML_NS_URI, LEADER, LEADER);
Iterator i = record.getControlFields().iterator();
while (i.hasNext()) {
ControlField field = (ControlField) i.next();
atts = new AttributesImpl();
atts.addAttribute("", "tag", "tag", "CDATA", field.getTag());
if (indent)
handler.ignorableWhitespace("\n ".toCharArray(), 0, 5);
handler.startElement(Constants.MARCXML_NS_URI, CONTROL_FIELD,
CONTROL_FIELD, atts);
temp = getDataElement(field.getData());
handler.characters(temp, 0, temp.length);
handler.endElement(Constants.MARCXML_NS_URI, CONTROL_FIELD,
CONTROL_FIELD);
}
i = record.getDataFields().iterator();
while (i.hasNext()) {
DataField field = (DataField) i.next();
atts = new AttributesImpl();
atts.addAttribute("", "tag", "tag", "CDATA", field.getTag());
atts.addAttribute("", "ind1", "ind1", "CDATA", String.valueOf(field
.getIndicator1()));
atts.addAttribute("", "ind2", "ind2", "CDATA", String.valueOf(field
.getIndicator2()));
if (indent)
handler.ignorableWhitespace("\n ".toCharArray(), 0, 5);
handler.startElement(Constants.MARCXML_NS_URI, DATA_FIELD,
DATA_FIELD, atts);
Iterator j = field.getSubfields().iterator();
while (j.hasNext()) {
Subfield subfield = (Subfield) j.next();
atts = new AttributesImpl();
atts.addAttribute("", "code", "code", "CDATA", String
.valueOf(subfield.getCode()));