Modifying XML file structure (Java)
Copy this code and paste it in your HTML
File[] files
= dir.
listFiles(); for (int i
=0; i
<files.
length; i
++) { if (!files
[i
].
getName().
endsWith(".xml")) { }
Element emission
= new SAXReader
().
read(files
[i
]).
getRootElement();
Element sondage
= emission.
addElement("pr:sondage"); sondage.addAttribute("xsi:nil", "true");
sondage.setText("n/a");
output
= new XMLWriter
(writer, OutputFormat.
createPrettyPrint());
e.printStackTrace();
} catch (DocumentException e
) e.printStackTrace();
e.printStackTrace();
}
}
}
}
}
Report this snippet
Comments
Subscribe to comments