Files
Athou_commafeed/src/main/java/com/commafeed/backend/rome/OPML11Parser.java

40 lines
869 B
Java
Raw Normal View History

2013-04-21 09:05:51 +02:00
package com.commafeed.backend.rome;
import java.util.Locale;
2014-08-15 13:51:13 +02:00
import org.jdom2.Document;
import org.jdom2.Element;
2013-04-21 09:05:51 +02:00
2014-08-15 13:51:13 +02:00
import com.rometools.opml.io.impl.OPML10Parser;
import com.rometools.rome.feed.WireFeed;
import com.rometools.rome.io.FeedException;
2013-04-21 09:05:51 +02:00
2013-07-26 16:00:02 +02:00
/**
* Support for OPML 1.1 parsing
*
*/
2013-04-21 09:05:51 +02:00
public class OPML11Parser extends OPML10Parser {
2013-07-25 09:17:33 +02:00
public OPML11Parser() {
super("opml_1.1");
}
2013-04-21 09:05:51 +02:00
@Override
public boolean isMyType(Document document) {
Element e = document.getRootElement();
2014-11-22 22:29:56 +01:00
if (e.getName().equals("opml")) {
2013-04-21 09:05:51 +02:00
return true;
}
return false;
2015-07-27 14:38:52 +02:00
}
@Override
public WireFeed parse(Document document, boolean validate, Locale locale) throws IllegalArgumentException, FeedException {
document.getRootElement().getChildren().add(new Element("head"));
return super.parse(document, validate, locale);
}
2013-04-21 09:05:51 +02:00
}