1 17 package com.sun.syndication.io.impl; 18 19 import com.sun.syndication.feed.module.Module; 20 import com.sun.syndication.feed.module.SyModule; 21 import com.sun.syndication.io.ModuleGenerator; 22 import org.jdom.Element; 23 import org.jdom.Namespace; 24 25 import java.util.Set ; 26 import java.util.HashSet ; 27 import java.util.Collections ; 28 29 36 37 public class SyModuleGenerator implements ModuleGenerator { 38 39 private static final String SY_URI = "http://purl.org/rss/1.0/modules/syndication/"; 40 private static final Namespace SY_NS = Namespace.getNamespace("sy", SY_URI); 41 42 private static final Set NAMESPACES; 43 44 static { 45 Set nss = new HashSet (); 46 nss.add(SY_NS); 47 NAMESPACES = Collections.unmodifiableSet(nss); 48 } 49 50 public String getNamespaceUri() { 51 return SY_URI; 52 } 53 54 63 public Set getNamespaces() { 64 return NAMESPACES; 65 } 66 67 public void generate(Module module, Element element) { 68 69 SyModule syModule = (SyModule)module; 70 71 Element updatePeriodElement = new Element("updatePeriod", SY_NS); 72 updatePeriodElement.addContent(syModule.getUpdatePeriod().toString()); 73 element.addContent(updatePeriodElement); 74 75 Element updateFrequencyElement = new Element("updateFrequency", SY_NS); 76 updateFrequencyElement.addContent(String.valueOf(syModule.getUpdateFrequency())); 77 element.addContent(updateFrequencyElement); 78 79 Element updateBaseElement = new Element("updateBase", SY_NS); 80 updateBaseElement.addContent(DateParser.formatW3CDateTime(syModule.getUpdateBase())); 81 element.addContent(updateBaseElement); 82 } 83 } 84 | Popular Tags |