X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkiss%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2FProgram.java;h=c80fea246badc9c8cfe19c2e9b0addb78e1ea392;hb=c0da3814aaa1e707d253202ceb44fa745c671de8;hp=89c3c88ce1704612eda0dc5044abac95474f6349;hpb=8c0b0a2d230139dff25630954e170e3c082395a6;p=utils diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java b/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java index 89c3c88c..c80fea24 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/Program.java @@ -20,6 +20,8 @@ import java.util.Comparator; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.dom4j.DocumentFactory; +import org.dom4j.Element; import org.wamblee.crawler.Action; import org.wamblee.crawler.Page; import org.wamblee.crawler.PageException; @@ -263,4 +265,21 @@ public class Program { return getName().equals(program.getName()) && _programInfo.equals(program._programInfo); } + + /** + * Converts program information to XML. + * @return XML representation of program information. + */ + public Element asXml() { + DocumentFactory factory = DocumentFactory.getInstance(); + Element program = factory.createElement("program"); + program.addElement("name").setText(getName()); + program.addElement("description").setText(getDescription()); + program.addElement("keywords").setText(getKeywords()); + program.addElement("channel").setText(getChannel()); + Element interval = program.addElement("interval"); + interval.addElement("begin").setText(getInterval().getBegin().toString()); + interval.addElement("end").setText(getInterval().getEnd().toString()); + return program; + } }