*/\r
public class MarcXmlWriter implements MarcWriter {\r
\r
- protected static final String prefix = "marc:";\r
+ protected static final String prefix = "marc";\r
+ protected static final String prefixColon = "marc" + ":";\r
protected static final String CONTROL_FIELD = "controlfield";\r
- protected static final String Q_CONTROL_FIELD = prefix + "controlfield";\r
+ \r
+ protected static final String Q_CONTROL_FIELD = prefixColon + CONTROL_FIELD;\r
\r
protected static final String DATA_FIELD = "datafield";\r
- protected static final String Q_DATA_FIELD = prefix + "datafield";\r
+ protected static final String Q_DATA_FIELD = prefixColon + DATA_FIELD;\r
\r
\r
protected static final String SUBFIELD = "subfield";\r
- protected static final String Q_SUBFIELD = prefix + "subfield";\r
+ protected static final String Q_SUBFIELD = prefixColon + SUBFIELD;\r
\r
protected static final String COLLECTION = "collection";\r
- protected static final String Q_COLLECTION = prefix + "collection";\r
+ protected static final String Q_COLLECTION = prefixColon + COLLECTION;\r
\r
protected static final String RECORD = "record";\r
- protected static final String Q_RECORD = prefix + "record";\r
+ protected static final String Q_RECORD = prefixColon + RECORD;\r
\r
protected static final String LEADER = "leader";\r
- protected static final String Q_LEADER = prefix + "leader";\r
+ protected static final String Q_LEADER = prefixColon + LEADER;\r
\r
private boolean indent = false;\r
\r
try {\r
AttributesImpl atts = new AttributesImpl();\r
handler.startDocument();\r
+ if (indent)\r
+ handler.ignorableWhitespace("\n".toCharArray(), 0, 1);\r
// The next line duplicates the namespace declaration for Marc XML\r
- handler.startPrefixMapping("marc", Constants.MARCXML_NS_URI);\r
+ handler.startPrefixMapping(prefix, Constants.MARCXML_NS_URI);\r
// add namespace declaration using attribute - need better solution\r
- atts.addAttribute(Constants.MARCXML_NS_URI, "xmlns", "xmlns:marc",\r
+ atts.addAttribute(Constants.MARCXML_NS_URI, "xmlns", "xmlns:" + prefix,\r
"CDATA", Constants.MARCXML_NS_URI); \r
handler.startElement(Constants.MARCXML_NS_URI, COLLECTION, Q_COLLECTION, atts);\r
} catch (SAXException e) {\r