javaxmlrssopml

Extract feeds list from an OPML file in java


I want to extract a list of feed information from an OPML file in java. I know I have to use some xml-parse technique, but I have no idea what to use.

I am a java beginner, so could you tell me how to do it and give me an example?

Thanks a lot!!


Solution

  • This should fairly straight forward. You can take one of hte following two approaches.

    1. Use java parsing capabilities and parse it as any XML file. Here is an example using DOM parse.

    2. There are lot of the open source code/libraries for doing this. Here is one such example. This class has a method public ArrayList<OpmlElement> readDocument(Reader reader). You can create a Reader object from the OPML file and pass the same to this function. Please note that this library depends on xml Pull parser libraries. So if you do not want to add another dependency use the first approach.

    3. Here is another example on this forum itself.