mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 03:50:02 +02:00
GT-3198 - fix FunctionBitPatternExplorerPlugin xml handling - codereview
Tweak output format, catch null value.
This commit is contained in:
parent
2c9b771d13
commit
e5184277ef
3 changed files with 22 additions and 2 deletions
|
@ -27,6 +27,7 @@ import javax.xml.parsers.SAXParserFactory;
|
|||
|
||||
import org.jdom.*;
|
||||
import org.jdom.input.SAXBuilder;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
import org.xml.sax.*;
|
||||
|
||||
|
@ -219,6 +220,23 @@ public class XmlUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a JDOM XML {@link Document} to a {@link File}, with a prettier
|
||||
* format than {@link #writeDocToFile(Document, File)}.
|
||||
* <p>
|
||||
*
|
||||
* @param doc JDOM XML {@link Document} to write.
|
||||
* @param dest {@link File} to write to.
|
||||
* @throws IOException if error when writing file.
|
||||
*/
|
||||
public static void writePrettyDocToFile(Document doc, File dest) throws IOException {
|
||||
XMLOutputter outputter = new XMLOutputter();
|
||||
outputter.setFormat(Format.getPrettyFormat());
|
||||
try (FileWriter fw = new FileWriter(dest)) {
|
||||
outputter.output(doc, fw);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a File and convert to jdom xml doc.
|
||||
* <p>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue