use of net.sourceforge.usbdm.deviceEditor.xmlParser.XmlDocumentUtilities in project usbdm-eclipse-plugins by podonoghue.
the class FamilyXmlWriter method writeXmlFile.
/**
* Writes XML file
*
* @param xmlFilePath Path to write XML to
* @param deviceInfomation Data to write
* @throws Exception
*/
public void writeXmlFile(Path xmlFilePath) throws Exception {
String xmlFilename = xmlFilePath.getFileName().toString();
BufferedWriter writer = Files.newBufferedWriter(xmlFilePath, StandardCharsets.UTF_8);
XmlDocumentUtilities documentUtilities = new XmlDocumentUtilities(writer);
documentUtilities.writeXmlFilePreamble(xmlFilename, DeviceInfo.DTD_FILE, "Generated from " + fDeviceInfo.getSourceFilename());
documentUtilities.openTag("root");
documentUtilities.writeAttribute("version", DeviceInfo.VERSION);
documentUtilities.openTag("family");
documentUtilities.writeAttribute("name", fDeviceInfo.getDeviceSubFamily());
for (String key : fDeviceInfo.getDeviceVariants().keySet()) {
DeviceVariantInformation deviceInformation = fDeviceInfo.findVariant(key);
documentUtilities.openTag("device");
documentUtilities.writeAttribute("name", deviceInformation.getName());
documentUtilities.writeAttribute("manual", deviceInformation.getManual());
documentUtilities.writeAttribute("package", deviceInformation.getPackage().getName());
documentUtilities.closeTag();
}
documentUtilities.closeTag();
writePeripherals(documentUtilities);
// writeSignals(documentUtilities);
writePins(documentUtilities);
writePackages(documentUtilities);
documentUtilities.closeTag();
writer.close();
}
use of net.sourceforge.usbdm.deviceEditor.xmlParser.XmlDocumentUtilities in project usbdm-eclipse-plugins by podonoghue.
the class Settings method save.
/**
* Save persistent settings to path
*
* @param path
*/
public void save(Path path) {
try {
BufferedWriter writer = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
fDocumentUtilities = new XmlDocumentUtilities(writer);
fDocumentUtilities.writeXmlFilePreamble(path.getFileName().toString(), null, "Settings");
save();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
Aggregations