summaryrefslogtreecommitdiffstats
path: root/dgbuilder/tools/FormatXml.java
diff options
context:
space:
mode:
authorTimoney, Dan (dt5972) <dtimoney@att.com>2018-11-06 13:39:01 -0500
committerTimoney, Dan (dt5972) <dtimoney@att.com>2018-11-06 13:39:01 -0500
commitb9b3b4b74e70cae099a6ccb0dd06427fdb5a2279 (patch)
tree70144dcfb7684b64f2c1fcb35dac538423a101d3 /dgbuilder/tools/FormatXml.java
parent78b70b90a20d8e6cd7e9b1da62397aa78b09b7ed (diff)
Remove obsolete dgbuilder
SDNC dgbuilder is no longer used - dgbuilder is now in CCSDK. Change-Id: I496e346ed3864779f36c00c354742f7d36447399 Issue-ID: SDNC-488 Signed-off-by: Timoney, Dan (dt5972) <dtimoney@att.com> Former-commit-id: e38fe292bd511784d1c145e84a9af7d94b6f3669
Diffstat (limited to 'dgbuilder/tools/FormatXml.java')
-rw-r--r--dgbuilder/tools/FormatXml.java49
1 files changed, 0 insertions, 49 deletions
diff --git a/dgbuilder/tools/FormatXml.java b/dgbuilder/tools/FormatXml.java
deleted file mode 100644
index 7c6915f7..00000000
--- a/dgbuilder/tools/FormatXml.java
+++ /dev/null
@@ -1,49 +0,0 @@
-import javax.xml.transform.*;
-import javax.xml.transform.stream.*;
-import java.io.*;
-import java.util.*;
-import java.nio.file.Paths;
-import java.nio.file.Files;
-import java.nio.charset.StandardCharsets;
-import java.nio.charset.Charset;
-public class FormatXml{
-public static String formatXml(String input, int indent) {
- try {
- Source xmlInput = new StreamSource(new StringReader(input));
- StringWriter stringWriter = new StringWriter();
- StreamResult xmlOutput = new StreamResult(stringWriter);
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- transformerFactory.setAttribute("indent-number", indent);
- Transformer transformer = transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.transform(xmlInput, xmlOutput);
- return xmlOutput.getWriter().toString();
- } catch (Exception e) {
- throw new RuntimeException(e); // simple exception handling, please review it
- }
-}
-
-public static String prettyFormat(String input) {
- return formatXml(input, 2);
-}
-
-public static String readFile(String path, Charset encoding)
- throws IOException
-{
- byte[] encoded = Files.readAllBytes(Paths.get(path));
- return new String(encoded, encoding);
-}
-
-public static void main(String[] args){
-try{
- if (args != null && args.length != 1){
- System.out.println("Usage:java FormatXml xmlStr");
- System.exit(-1);
- }
- String xmlStr = readFile(args[0], StandardCharsets.UTF_8);
- System.out.println(prettyFormat(xmlStr));
-}catch(Exception e){
- e.printStackTrace();
-}
-}
-}