Skip to content

Commit

Permalink
started creating XML Reader and Writer'
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedKhaledS committed Jan 29, 2017
1 parent b6fe833 commit 3c90330
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/services/file/XmlReader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package services.file;

/**
* Created by Ahmed Khaled on 28/01/2017.
*/
public class XmlReader {
}
40 changes: 40 additions & 0 deletions src/services/file/XmlWriter.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 3c90330

Please sign in to comment.