Skip to content

Commit

Permalink
don't add duplicate namespace definitions.
Browse files Browse the repository at this point in the history
  • Loading branch information
james.carr@preservica.com committed May 22, 2020
1 parent 86b6242 commit 18e710e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CSV2Metadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,16 @@ private int parse(File csvDocument, File folder, String filenameColumn, String r
osw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
osw.write(System.getProperty("line.separator"));

String root = String.format("%s:%s xmlns:%s=\"%s\" %s %s", rootPrefix, rootElement, rootPrefix, rootNamespace, DCTERMS_NS, XSI_NS);
String root = String.format("%s:%s xmlns:%s=\"%s\"", rootPrefix, rootElement, rootPrefix, rootNamespace);
if (!root.contains(DC_NS)) {
root = String.format("%s %s", root, DC_NS);
}
if (!root.contains(DCTERMS_NS)) {
root = String.format("%s %s", root, DCTERMS_NS);
}
if (!root.contains(XSI_NS)) {
root = String.format("%s %s", root, XSI_NS);
}
osw.write("<");
osw.write(root);
osw.write(">");
Expand Down

0 comments on commit 18e710e

Please sign in to comment.