Skip to content

Commit

Permalink
Path to .xml file is a command line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
phlobo committed Jul 30, 2020
1 parent 22f13ac commit 80ede32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This repository contains the code to reproduce the results in:
# Processing the data

## Conversion of GGPOnc corpus XML file to plain text and preprocessing
* Run `mvn compile` before executing `mvn exec:java -Dexec.mainClass="de.hpi.guidelines.reader.CPGXMLReader"` or run `CPGXMLReader.java` (in package `de.hpi.guidelines.reader`) in Eclipse (Run As => Java Application)
* Run `mvn compile` before executing `mvn exec:java -Dexec.mainClass="de.hpi.guidelines.reader.GGPOncXMLReader" -Dexec.args="<Path to cpg-corpus-cms.xml>"` or run `GGPOncXMLReader.java` (in package `de.hpi.guidelines.reader`) in Eclipse (Run As => Java Application)
* Wait a minute
* Look into the directory `/output`

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/de/hpi/guidelines/reader/GGPOncXMLReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public class GGPOncXMLReader {

public static final Logger LOGGER = Logger.getLogger(GGPOncXMLReader.class.getName());

private static Path importFile = Paths.get("src", "main", "resources", "cpg-corpus-cms.xml");

private static final Path output = Paths.get("output-GGPOnc-data");
private static final Path outDirXML = Paths.get(output + File.separator + "xml");
private static final Path outDirTXT = Paths.get(output + File.separator + "txt");
Expand All @@ -72,9 +70,10 @@ protected void setOutputStream(OutputStream out) throws SecurityException {
}

public static void main(String[] args) throws Exception {
String importFile = args[0];
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(importFile.toFile());
Document doc = dBuilder.parse(new File(importFile));

doc.getDocumentElement().normalize();

Expand Down

0 comments on commit 80ede32

Please sign in to comment.