-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
started creating XML Reader and Writer'
- Loading branch information
1 parent
b6fe833
commit 3c90330
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |