|
|
|
@ -166,10 +166,9 @@ public abstract class XMLReader {
|
|
|
|
* @param path path of the XML
|
|
|
|
* @param path path of the XML
|
|
|
|
* @param encoding encoding of the xml
|
|
|
|
* @param encoding encoding of the xml
|
|
|
|
* @return A string containing the contents of the specified file.
|
|
|
|
* @return A string containing the contents of the specified file.
|
|
|
|
* @throws TransformerException Issue with the XML format
|
|
|
|
|
|
|
|
* @throws XMLReaderException Thrown if file cannot be read for some reason.
|
|
|
|
* @throws XMLReaderException Thrown if file cannot be read for some reason.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public static String readXMLFileToString(String path, Charset encoding) throws TransformerException, XMLReaderException {
|
|
|
|
public static String readXMLFileToString(String path, Charset encoding) throws XMLReaderException {
|
|
|
|
|
|
|
|
|
|
|
|
InputStream fileStream = XMLReader.class.getClassLoader().getResourceAsStream(path);
|
|
|
|
InputStream fileStream = XMLReader.class.getClassLoader().getResourceAsStream(path);
|
|
|
|
|
|
|
|
|
|
|
|
@ -182,7 +181,11 @@ public abstract class XMLReader {
|
|
|
|
|
|
|
|
|
|
|
|
doc.getDocumentElement().normalize();
|
|
|
|
doc.getDocumentElement().normalize();
|
|
|
|
|
|
|
|
|
|
|
|
return XMLReader.getContents(doc);
|
|
|
|
try {
|
|
|
|
|
|
|
|
return XMLReader.getContents(doc);
|
|
|
|
|
|
|
|
} catch (TransformerException e) {
|
|
|
|
|
|
|
|
throw new XMLReaderException("Could not get XML file contents.", e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|