From 3c90330881e8317d81d244023d84a8b775684059 Mon Sep 17 00:00:00 2001 From: Ahmed Khaled Date: Mon, 30 Jan 2017 00:49:35 +0200 Subject: [PATCH] started creating XML Reader and Writer' --- src/services/file/XmlReader.java | 7 ++++++ src/services/file/XmlWriter.java | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/services/file/XmlReader.java create mode 100644 src/services/file/XmlWriter.java diff --git a/src/services/file/XmlReader.java b/src/services/file/XmlReader.java new file mode 100644 index 0000000..ffb066f --- /dev/null +++ b/src/services/file/XmlReader.java @@ -0,0 +1,7 @@ +package services.file; + +/** + * Created by Ahmed Khaled on 28/01/2017. + */ +public class XmlReader { +} diff --git a/src/services/file/XmlWriter.java b/src/services/file/XmlWriter.java new file mode 100644 index 0000000..eff8024 --- /dev/null +++ b/src/services/file/XmlWriter.java @@ -0,0 +1,40 @@ +package services.file; + +import models.data.ModelDataHolder; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +/** + * Created by Ahmed Khaled on 28/01/2017. + */ +public class XmlWriter implements FileWriter { + private Document doc; + private Element root; + public XmlWriter() { + try { + DocumentBuilderFactory docFactory = DocumentBuilderFactory + .newInstance(); + DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); + doc = docBuilder.newDocument(); + root = doc.createElement("Game"); + } catch (ParserConfigurationException e) { + e.printStackTrace(); + } + } + private static Logger logger = LogManager.getLogger(XmlWriter.class); + @Override + public void write(ModelDataHolder dataHolder, String path, String fileName) { + + } + + @Override + public String getExtension() { + return null; + } +}