Search code examples
javaxmlxml-parsingxstreampojo

parse XML to POJO using XStream


I have an xml file which I want to read and parse it into POJO.

I am using XStream for this.

I am not able to send the file as an input to the code for parsing(file is on my local drive).

How to read the xml file and parse it using fromXML() method ?

I would be gratefull if someone can give example for sending xml file as input and parsing it to POJO and printing it on the screen

Thanks...


Solution

  • Based on the provided comments, I can better understand the problem you are facing. I believe the answer you are looking for is implicit collections. Check out the XStream tutorial on aliasing: http://x-stream.github.io/alias-tutorial.html .