The list of methods to do XML String Transform are organized into topic(s).
void
applyXSL(File xmlFile, File xslFile, String outputFilename) Transforms an xml-file (xmlFilename) using an xsl-file (xslFilename) and writes the output into file (outputFilename).
try {
StreamSource xslStream = new StreamSource(xslFile);
TransformerFactory transFactory = TransformerFactory.newInstance();
Transformer transformer = transFactory.newTransformer(xslStream);
StreamSource xmlStream = new StreamSource(xmlFile);
StreamResult result = new StreamResult(new BufferedWriter(new FileWriter(outputFilename)));
transformer.transform(xmlStream, result);
result.getWriter().close();
...
void
convertPlist(File info_plist_file, String script_url, Map script_parameters) convert Plist
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder document_builder = factory.newDocumentBuilder();
document_builder.setEntityResolver((String publicId, String systemId) -> {
if (publicId.equals("-//Apple Computer//DTD PLIST 1.0//EN"))
return new InputSource(
new ByteArrayInputStream("<?xml version='1.0' encoding='UTF-8'?>".getBytes()));
else
...
void
convertValidatorResult(Result result, StringWriter writer) Writes the content of the given Result into a StringWriter
if (result instanceof DOMResult) {
convertResult((DOMResult) result, writer);
} else if (result instanceof StreamResult) {
convertResult((StreamResult) result, writer);
} else {
throw new RuntimeException(String.format("Could not evaluate Schematron validation result of type '%s'",
result.getClass().getCanonicalName()));
void
createFullReportLog(String sessionLogDir) Generate a file in logDir refererring all logfiles.
File xml_logs_report_file = new File(sessionLogDir + File.separator + "report_logs.xml");
if (xml_logs_report_file.exists()) {
xml_logs_report_file.delete();
xml_logs_report_file.createNewFile();
xml_logs_report_file = new File(sessionLogDir + File.separator + "report_logs.xml");
OutputStream report_logs = new FileOutputStream(xml_logs_report_file);
List<File> files = null;
...
Object
createObject(String classname) create an object using reflection Examples JDReflectionUtil.createObject("com.ibm.db2.jcc.DB2XADataSource") callMethod_V(ds, "setTranslateHex", "character");
Class objectClass1 = Class.forName(classname);
Class[] noArgTypes = new Class[0];
Object[] noArgs = new Object[0];
Object newObject = null;
try {
Constructor constructor = objectClass1.getConstructor(noArgTypes);
newObject = constructor.newInstance(noArgs);
} catch (java.lang.reflect.InvocationTargetException ite) {
...