Java Implementation Web version RSS reader (i) dom4j read XML (OPML) file

Source: Internet
Author: User
Tags versions java web

Touch Java soon, I have a harvest, and recently want to do a web version of the RSS reader to exercise. There are several OPML files that are exported from different versions of Foxmail, and you should know that OPML files are in XML format. So let's start here and practice reading XML files using DOM4J.

In Java programming, especially Java Web Development program, XML application frequency is very high. All kinds of web frameworks, such as Spring, Hibernate, struts, MyEclipse, Oracle, and so on, are mainly based on XML. XML can be said to have a vital role in the configuration of the system. And these also enhance the flexibility of the system.

First of all, the idea:

Creates a new Java Web project, but does not use Jsp,servlet for the time being. This article simply uses a self-contained debugger to test read XML first. In the next blog post, you will be shown in the optimized interface and provide most of the functions of the RSS reader.

The file format is slightly different because it is exported from different versions of Foxmail, and the main disagreement is on the subscription grouping feature. Some versions of the packet information is in the Head/title content, Body/outline is all the subscription information, and some of the grouped information is in the Body/outline title and Text properties, and detailed subscription information is placed in the body/ In Outline/outline.

I want to do the system can support reading multiple OPML files, so need an RSS file list configuration file "Rss_config.xml", corresponding to an entity: Rssconfigbean.java, mainly contains OPML file path information, group information also need to come out separately, named "Rssteambean.java", including title and text two attributes and a list of subscription information. Subscription information is definitely independent, named "Rssbean.java", including text, title, XMLURL, Htmlurl, version, type six properties.

First, by reading Rss_config.xml, get all the OPML file paths, and then loop through the OPML, get the packet information and all the detailed subscription information under each group, and save it to the entity for the call display.

The light says no use, directly on the code:

①. opml file

"Single Packet Foxmail6.5.opml"

<?xml version= "1.0"?>  
<opml version= "1.1" >  
    

"Multi-group FOXMAIL7.OPML"

<?xml version= "1.0" encoding= "UTF-8"?> <opml version= "1.0" >  

More Wonderful content: http://www.bianceng.cn/Programming/Java/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.