Skip to content

Commit

Permalink
keep doctype
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Aug 29, 2024
1 parent 36a84da commit ae90f7c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/org/matsim/dashboard/AdaptV2OutputFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import org.matsim.contrib.dvrp.fleet.FleetReader;
import org.matsim.contrib.dvrp.fleet.FleetSpecification;
import org.matsim.contrib.dvrp.fleet.FleetSpecificationImpl;
import org.w3c.dom.Comment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import picocli.CommandLine;
import tech.tablesaw.api.DoubleColumn;
Expand Down Expand Up @@ -172,6 +169,8 @@ private static void adaptConfigAndWriteXml(File inputConfigFile) throws ParserCo
Document doc = dBuilder.parse(inputConfigFile);
doc.getDocumentElement().normalize();

DocumentType doctype = doc.getDoctype();

NodeList moduleList = doc.getElementsByTagName("module");
for (int i = 0; i < moduleList.getLength(); i++) {
Element moduleElement = (Element) moduleList.item(i);
Expand Down Expand Up @@ -216,6 +215,9 @@ private static void adaptConfigAndWriteXml(File inputConfigFile) throws ParserCo

TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();

transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, doctype.getSystemId());

DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(inputConfigFile);
transformer.setOutputProperty(OutputKeys.INDENT, "no");
Expand Down

0 comments on commit ae90f7c

Please sign in to comment.