Not new to Java; but relatively new to XML-parsing. I know a tiny bit about a lot of the XML tools out there, but not much about any of them. I am also not an XML-pro.My particular problem is this... I have been given an XML-document which I cannot modify and from which I need only to parse random bits of it into Java objects. Sheer speed is not much of a factor so long as it's reasonable. Likewise, memory-footprint need not be absolutely optimal either, just not insane. I only need to read through the document one time to parse it, after that I'll be throwing it in the bitbucket and just using my POJO.So, I'm open to suggestion... which tool would you use?
And, would you kindly suggest a bit of starter-code to address my particular need?Here's a snippet of sample XML and the associated POJO I'm trying to craft:\[code\]<xml> <item id="..."> ... </item> <metadata> <resources> <resource> <ittype>Service_Links</ittype> <links> <link> <path>http://www.stackoverflow.com</path> <description>Stack Overflow</description> </link> <link> <path>http://www.google.com</path> <description>Google</description> </link> </links> </resource> <resource> <ittype>Article_Links</ittype> <links> ... </links> </resource> ... </resources> </metadata></xml>public class MyPojo { @Attribute(name="id") @Path("item") public String id; @ElementList(entry="link") @Path("metadata/resources/resource/links") public List<Link> links;}\[/code\]NOTE: this question was originally spawned by this question with me trying to solve it using SimpleXml; I'm to the point where I thought maybe someone could suggest a different route to solving the same problem.Also Note: I'm really hoping for a CLEAN solution... by which I mean, using annotations and/or xpath with the least amount of code... the last thing I want is huge class file with huge unwieldy methods... THAT, I already have... I'm trying to find a better way.
And, would you kindly suggest a bit of starter-code to address my particular need?Here's a snippet of sample XML and the associated POJO I'm trying to craft:\[code\]<xml> <item id="..."> ... </item> <metadata> <resources> <resource> <ittype>Service_Links</ittype> <links> <link> <path>http://www.stackoverflow.com</path> <description>Stack Overflow</description> </link> <link> <path>http://www.google.com</path> <description>Google</description> </link> </links> </resource> <resource> <ittype>Article_Links</ittype> <links> ... </links> </resource> ... </resources> </metadata></xml>public class MyPojo { @Attribute(name="id") @Path("item") public String id; @ElementList(entry="link") @Path("metadata/resources/resource/links") public List<Link> links;}\[/code\]NOTE: this question was originally spawned by this question with me trying to solve it using SimpleXml; I'm to the point where I thought maybe someone could suggest a different route to solving the same problem.Also Note: I'm really hoping for a CLEAN solution... by which I mean, using annotations and/or xpath with the least amount of code... the last thing I want is huge class file with huge unwieldy methods... THAT, I already have... I'm trying to find a better way.