I am trying to load an XML document from System.in
in order to be able to pipe my program. But the XML doesn't seem to load correctly since I get a NullPointerExeption
where my program is looking for root element.
I am trying to use this solution.
Here is my code to load from System.in
(never prints out "ok") :
org.jdom2.Document jdomDoc
public LoadFile(String fileLocation) {
if (fileLocation.compareTo("System.in") == 0) {
Scanner sc = new Scanner(System.in);
log.info(sc.toString()); // debug purpose
while (sc.hasNextLine()) {
log.info("ok"); // debug purpose
jdomDoc.addContent(new Element(sc.nextLine()+ "\n"));
}
}
And I give fileLocation "System.in
" if no -i (input) parameter has been found. I run it from cmd with :
myXml.xml|java -jar myProgramm.jar
Ok, dumb error, simple typo in my command : forgot
type myXml.xml|java -jar myProgramm.jar