You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ja...@apache.org on 2014/01/08 16:25:55 UTC

[39/51] [abbrv] [partial] MARMOTTA-397: Reorganized and renamed Marmotta Sesame Tools

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
new file mode 100644
index 0000000..f10e5cc
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PluginManager.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.io.DelegatingModuleGenerator;
+import com.sun.syndication.io.DelegatingModuleParser;
+import com.sun.syndication.io.WireFeedGenerator;
+import com.sun.syndication.io.WireFeedParser;
+
+import java.util.*;
+
+/**
+ * <p>
+ * @author Alejandro Abdelnur
+ *
+ */
+public abstract class PluginManager {
+    private String[] _propertyValues;
+    private Map _pluginsMap;
+    private List _pluginsList;
+    private List _keys;
+    private WireFeedParser _parentParser;
+    private WireFeedGenerator _parentGenerator;
+
+    /**
+     * Creates a PluginManager
+     * <p>
+     * @param propertyKey property key defining the plugins classes
+     *
+     */
+    protected PluginManager(String propertyKey) {
+        this(propertyKey, null, null);
+    }
+
+    protected PluginManager(String propertyKey, WireFeedParser parentParser,
+                            WireFeedGenerator parentGenerator)
+    {
+        _parentParser = parentParser;
+        _parentGenerator = parentGenerator;
+        _propertyValues = PropertiesLoader.getPropertiesLoader().getTokenizedProperty(propertyKey,", ");
+        loadPlugins();
+        _pluginsMap = Collections.unmodifiableMap(_pluginsMap);
+        _pluginsList = Collections.unmodifiableList(_pluginsList);
+        _keys = Collections.unmodifiableList(new ArrayList(_pluginsMap.keySet()));
+    }
+
+    protected abstract String getKey(Object obj);
+
+    protected List getKeys() {
+        return _keys;
+    }
+
+    protected List getPlugins() {
+        return _pluginsList;
+    }
+
+    protected Map getPluginMap() {
+        return _pluginsMap;
+    }
+
+    protected Object getPlugin(String key) {
+        return _pluginsMap.get(key);
+    }
+
+    // PRIVATE - LOADER PART
+
+    private void loadPlugins() {
+        List finalPluginsList = new ArrayList();
+        _pluginsList = new ArrayList();
+        _pluginsMap = new HashMap();
+        String className = null;
+        try {
+            Class[] classes = getClasses();
+            for (int i=0;i<classes.length;i++) {
+                className = classes[i].getName();
+                Object plugin  = classes[i].newInstance();
+                if (plugin instanceof DelegatingModuleParser) {
+                    ((DelegatingModuleParser) plugin).setFeedParser(_parentParser);
+                }
+                if (plugin instanceof DelegatingModuleGenerator) {
+                    ((DelegatingModuleGenerator) plugin).setFeedGenerator(_parentGenerator);
+                }
+
+                _pluginsMap.put(getKey(plugin), plugin);
+                _pluginsList.add(plugin); // to preserve the order of definition in the rome.properties files
+            }
+            Iterator i = _pluginsMap.values().iterator();
+            while (i.hasNext()) {
+                finalPluginsList.add(i.next()); // to remove overridden plugin impls
+            }
+
+            i = _pluginsList.iterator();
+            while (i.hasNext()) {
+                Object plugin = i.next();
+                if (!finalPluginsList.contains(plugin)) {
+                    i.remove();
+                }
+            }
+        }
+        catch (Exception ex) {
+            throw new RuntimeException("could not instantiate plugin "+className,ex);
+        }catch (ExceptionInInitializerError er) {
+            throw new RuntimeException("could not instantiate plugin "+className,er);
+        }
+    }
+
+    /**
+     * Loads and returns the classes defined in the properties files. If the system property "rome.pluginmanager.useloadclass" is
+     * set to true then classLoader.loadClass will be used to load classes (instead of Class.forName). This is designed to improve
+     * OSGi compatibility. Further information can be found in https://rome.dev.java.net/issues/show_bug.cgi?id=118 
+     * <p>
+     * @return array containing the classes defined in the properties files.
+     * @throws java.lang.ClassNotFoundException thrown if one of the classes defined in the properties file cannot be loaded
+     *         and hard failure is ON.
+     *
+     */
+    private Class[] getClasses() throws ClassNotFoundException {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+        List classes = new ArrayList();
+        boolean useLoadClass = Boolean.valueOf(System.getProperty("rome.pluginmanager.useloadclass", "false")).booleanValue();
+        for (int i = 0; i <_propertyValues.length; i++) {
+        	Class mClass = (useLoadClass ?  classLoader.loadClass(_propertyValues[i]) : Class.forName(_propertyValues[i], true, classLoader));
+            classes.add(mClass);
+        }
+        Class[] array = new Class[classes.size()];
+        classes.toArray(array);
+        return array;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
new file mode 100644
index 0000000..2954bed
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/PropertiesLoader.java
@@ -0,0 +1,155 @@
+package com.sun.syndication.io.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.*;
+
+/**
+ * Properties loader that aggregates a master properties file and several extra properties files,
+ * all from the current classpath.
+ * <P>
+ * The master properties file has to be in a distinct location than the extra properties files.
+ * First the master properties file is loaded, then all the extra properties files in their order
+ * of appearance in the classpath.
+ * <P>
+ * Current use cases (plugin manager for parsers/converters/generators for feeds and modules
+ * and date formats) assume properties are list of tokens, that why the only method to get
+ * property values is the getTokenizedProperty().
+ * <p>
+ *
+ * @author Alejandro Abdelnur
+ *
+ */
+public class PropertiesLoader {
+
+    private static final String MASTER_PLUGIN_FILE = "com/sun/syndication/rome.properties";
+    private static final String EXTRA_PLUGIN_FILE = "rome.properties";
+
+
+    private static Map clMap =
+        new WeakHashMap();
+
+
+    /**
+     * Returns the PropertiesLoader singleton used by ROME to load plugin components.
+     *
+     * @return PropertiesLoader singleton.
+     *
+     */
+    public static PropertiesLoader getPropertiesLoader() {
+        synchronized(PropertiesLoader.class) {
+            PropertiesLoader loader = (PropertiesLoader)
+                clMap.get(Thread.currentThread().getContextClassLoader());
+            if (loader == null) {
+                try {
+                    loader = new PropertiesLoader(MASTER_PLUGIN_FILE, EXTRA_PLUGIN_FILE);
+                    clMap.put(Thread.currentThread().getContextClassLoader(), loader);
+                }
+                catch (IOException ex) {
+                    throw new RuntimeException(ex);
+                }
+            }
+            return loader;
+        }
+    }
+
+    private Properties[] _properties;
+
+    /**
+     * Creates a PropertiesLoader.
+     * <p>
+     * @param masterFileLocation master file location, there must be only one.
+     * @param extraFileLocation extra file location, there may be many.
+     * @throws IOException thrown if one of the properties file could not be read.
+     *
+     */
+    private PropertiesLoader(String masterFileLocation,String extraFileLocation) throws IOException {
+        List propertiesList = new ArrayList();
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+
+        try {
+            InputStream is = classLoader.getResourceAsStream(masterFileLocation);
+            Properties p = new Properties();
+            p.load(is);
+            is.close();
+            propertiesList.add(p);
+        }
+        catch (IOException ioex) {
+            IOException ex = new IOException("could not load ROME master plugins file ["+masterFileLocation+"], "+
+                                             ioex.getMessage());
+            ex.setStackTrace(ioex.getStackTrace());
+            throw ex;
+        }
+
+        Enumeration urls = classLoader.getResources(extraFileLocation);
+        while (urls.hasMoreElements()) {
+            URL url = (URL) urls.nextElement();
+            Properties p = new Properties();
+            try {
+                InputStream is = url.openStream();
+                p.load(is);
+                is.close();
+            }
+            catch (IOException ioex) {
+                IOException ex = new IOException("could not load ROME extensions plugins file ["+url.toString()+"], "+
+                                                 ioex.getMessage());
+                ex.setStackTrace(ioex.getStackTrace());
+                throw ex;
+            }
+            propertiesList.add(p);
+        }
+
+        _properties = new Properties[propertiesList.size()];
+        propertiesList.toArray(_properties);
+    }
+
+    /**
+     * Returns an array of tokenized values stored under a property key in all properties files.
+     * If the master file has this property its tokens will be the first ones in the array.
+     * <p>
+     * @param key property key to retrieve values
+     * @param separator String with all separator characters to tokenize from the values in all
+     * properties files.
+     * @return all the tokens for the given property key from all the properties files.
+     *
+     */
+    public String[] getTokenizedProperty(String key,String separator) {
+        List entriesList = new ArrayList();
+        for (int i=0;i<_properties.length;i++) {
+            String values = _properties[i].getProperty(key);
+            if (values!=null) {
+                StringTokenizer st = new StringTokenizer(values,separator);
+                while (st.hasMoreTokens()) {
+                    String token = st.nextToken();
+                    entriesList.add(token);
+                }
+            }
+        }
+        String[] entries = new String[entriesList.size()];
+        entriesList.toArray(entries);
+        return entries;
+    }
+
+    /**
+     * Returns an array of values stored under a property key in all properties files.
+     * If the master file has this property it will be the first ones in the array.
+     * <p>
+     * @param key property key to retrieve values
+     * @return all the values for the given property key from all the properties files.
+     *
+     */
+    public String[] getProperty(String key) {
+        List entriesList = new ArrayList();
+        for (int i=0;i<_properties.length;i++) {
+            String values = _properties[i].getProperty(key);
+            if (values!=null) {
+                entriesList.add(values);
+            }
+        }
+        String[] entries = new String[entriesList.size()];
+        entriesList.toArray(entries);
+        return entries;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Generator.java
new file mode 100644
index 0000000..81c014c
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Generator.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.rss.*;
+import com.sun.syndication.io.FeedException;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
+
+import java.util.List;
+
+
+/**
+ * Feed Generator for RSS 0.90
+ * <p/>
+ *
+ * @author Elaine Chien
+ */
+public class RSS090Generator extends BaseWireFeedGenerator {
+
+    private static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+    private static final String RSS_URI = "http://my.netscape.com/rdf/simple/0.9/";
+    private static final String CONTENT_URI = "http://purl.org/rss/1.0/modules/content/";
+
+    private static final Namespace RDF_NS = Namespace.getNamespace("rdf", RDF_URI);
+    private static final Namespace RSS_NS = Namespace.getNamespace(RSS_URI);
+    private static final Namespace CONTENT_NS = Namespace.getNamespace("content", CONTENT_URI);
+
+    public RSS090Generator() {
+        this("rss_0.9");
+    }
+
+    protected RSS090Generator(String type) {
+        super(type);
+    }
+
+    public Document generate(WireFeed feed) throws FeedException {
+        Channel channel = (Channel)feed;
+        Element root = createRootElement(channel);
+        populateFeed(channel,root);
+        purgeUnusedNamespaceDeclarations(root);
+        return createDocument(root);
+    }
+
+    protected Namespace getFeedNamespace() {
+        return RSS_NS;
+    }
+
+    protected Namespace getRDFNamespace() {
+        return RDF_NS;
+    }
+
+    protected Namespace getContentNamespace() {
+        return CONTENT_NS;
+    }
+
+    protected Document createDocument(Element root) {
+        return new Document(root);
+    }
+
+    protected Element createRootElement(Channel channel) {
+        Element root = new Element("RDF",getRDFNamespace());
+        root.addNamespaceDeclaration(getFeedNamespace());
+        root.addNamespaceDeclaration(getRDFNamespace());
+        root.addNamespaceDeclaration(getContentNamespace());
+        generateModuleNamespaceDefs(root);
+        return root;
+    }
+
+    protected void populateFeed(Channel channel, Element parent) throws FeedException  {
+        addChannel(channel,parent);
+        addImage(channel,parent);
+        addTextInput(channel,parent);
+        addItems(channel,parent);
+        generateForeignMarkup(parent, (List)channel.getForeignMarkup());
+    }
+
+    protected void addChannel(Channel channel,Element parent) throws FeedException {
+        Element eChannel = new Element("channel", getFeedNamespace());
+        populateChannel(channel,eChannel);
+        checkChannelConstraints(eChannel);
+        parent.addContent(eChannel);
+        generateFeedModules(channel.getModules(),eChannel);
+    }
+
+    /**
+     * Populates the given channel with parsed data from the ROME element that holds the
+     * channel data.
+     *
+     * @param channel the channel into which parsed data will be added.
+     * @param eChannel the XML element that holds the data for the channel.
+     */
+    protected void populateChannel(Channel channel,Element eChannel) {
+        String title = channel.getTitle();
+        if (title!=null) {
+            eChannel.addContent(generateSimpleElement("title",title));
+        }
+        String link = channel.getLink();
+        if (link!=null) {
+            eChannel.addContent(generateSimpleElement("link",link));
+        }
+        String description = channel.getDescription();
+        if (description!=null) {
+            eChannel.addContent(generateSimpleElement("description",description));
+        }
+    }
+
+    // maxLen == -1 means unlimited.
+    protected void checkNotNullAndLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
+        Element  child = parent.getChild(childName,getFeedNamespace());
+        if (child == null) {
+            throw new FeedException("Invalid "+getType()+" feed, missing "+parent.getName()+" "+childName);
+        }
+        checkLength(parent,childName,minLen,maxLen);
+    }
+
+    // maxLen == -1 means unlimited.
+    protected void checkLength(Element parent, String childName, int minLen, int maxLen) throws FeedException {
+        Element  child = parent.getChild(childName,getFeedNamespace());
+        if (child != null) {
+            if (minLen>0 && child.getText().length()<minLen) {
+                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "short of "+minLen+" length");
+            }
+            if (maxLen>-1 && child.getText().length()>maxLen) {
+                throw new FeedException("Invalid "+getType()+" feed, "+parent.getName()+" "+childName + "exceeds "+maxLen+" length");
+            }
+        }
+    }
+
+
+    protected void addImage(Channel channel,Element parent) throws FeedException {
+        Image image = channel.getImage();
+        if (image!=null) {
+            Element eImage = new Element("image", getFeedNamespace());
+            populateImage(image,eImage);
+            checkImageConstraints(eImage);
+            parent.addContent(eImage);
+        }
+    }
+
+    protected void populateImage(Image image,Element eImage) {
+        String title = image.getTitle();
+        if (title!=null) {
+            eImage.addContent(generateSimpleElement("title",title));
+        }
+        String url = image.getUrl();
+        if (url!=null) {
+            eImage.addContent(generateSimpleElement("url",url));
+        }
+        String link = image.getLink();
+        if (link!=null) {
+            eImage.addContent(generateSimpleElement("link",link));
+        }
+    }
+
+    // Thxs DW for this one
+    protected String getTextInputLabel() {
+        return "textInput";
+    }
+
+    protected void addTextInput(Channel channel,Element parent) throws FeedException {
+        TextInput textInput = channel.getTextInput();
+        if (textInput!=null) {
+            Element eTextInput = new Element(getTextInputLabel(), getFeedNamespace());
+            populateTextInput(textInput,eTextInput);
+            checkTextInputConstraints(eTextInput);
+            parent.addContent(eTextInput);
+        }
+    }
+
+    protected void populateTextInput(TextInput textInput,Element eTextInput) {
+        String title = textInput.getTitle();
+        if (title!=null) {
+            eTextInput.addContent(generateSimpleElement("title",title));
+        }
+        String description = textInput.getDescription();
+        if (description!=null) {
+            eTextInput.addContent(generateSimpleElement("description",description));
+        }
+        String name = textInput.getName();
+        if (name!=null) {
+            eTextInput.addContent(generateSimpleElement("name",name));
+        }
+        String link = textInput.getLink();
+        if (link!=null) {
+            eTextInput.addContent(generateSimpleElement("link",link));
+        }
+    }
+
+    protected void addItems(Channel channel,Element parent) throws FeedException {
+        List items = channel.getItems();
+        for (int i=0;i<items.size();i++) {
+            addItem((Item)items.get(i),parent, i);
+        }
+        checkItemsConstraints(parent);
+    }
+
+    protected void addItem(Item item, Element parent, int index) throws FeedException {
+        Element eItem = new Element("item", getFeedNamespace());
+        populateItem(item,eItem, index);
+        checkItemConstraints(eItem);
+        generateItemModules(item.getModules(),eItem);
+        parent.addContent(eItem);
+    }
+
+    protected void populateItem(Item item, Element eItem, int index) {
+        String title = item.getTitle();
+        if (title!=null) {
+            eItem.addContent(generateSimpleElement("title",title));
+        }
+        String link = item.getLink();
+        if (link!=null) {
+            eItem.addContent(generateSimpleElement("link",link));
+        }
+        generateForeignMarkup(eItem, (List)item.getForeignMarkup());
+    }
+
+    protected Element generateSimpleElement(String name, String value) {
+        Element element = new Element(name, getFeedNamespace());
+        element.addContent(value);
+        return element;
+    }
+
+    protected void checkChannelConstraints(Element eChannel) throws FeedException {
+        checkNotNullAndLength(eChannel,"title", 0, 40);
+        checkNotNullAndLength(eChannel,"description", 0, 500);
+        checkNotNullAndLength(eChannel,"link", 0, 500);
+    }
+
+    protected void checkImageConstraints(Element eImage) throws FeedException {
+        checkNotNullAndLength(eImage,"title", 0, 40);
+        checkNotNullAndLength(eImage,"url", 0, 500);
+        checkNotNullAndLength(eImage,"link", 0, 500);
+    }
+
+    protected void checkTextInputConstraints(Element eTextInput) throws FeedException {
+        checkNotNullAndLength(eTextInput,"title", 0, 40);
+        checkNotNullAndLength(eTextInput,"description", 0, 100);
+        checkNotNullAndLength(eTextInput,"name", 0, 500);
+        checkNotNullAndLength(eTextInput,"link", 0, 500);
+    }
+
+    protected void checkItemsConstraints(Element parent) throws FeedException {
+        int count = parent.getChildren("item",getFeedNamespace()).size();
+        if (count<1 || count>15) {
+            throw new FeedException("Invalid "+getType()+" feed, item count is "+count+" it must be between 1 an 15");
+        }
+    }
+
+    protected void checkItemConstraints(Element eItem) throws FeedException {
+        checkNotNullAndLength(eItem,"title", 0, 100);
+        checkNotNullAndLength(eItem,"link", 0, 500);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
new file mode 100644
index 0000000..94a85f1
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS090Parser.java
@@ -0,0 +1,346 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Image;
+import com.sun.syndication.feed.rss.Item;
+import com.sun.syndication.feed.rss.TextInput;
+import com.sun.syndication.io.FeedException;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ */
+public class RSS090Parser extends BaseWireFeedParser {
+
+    private static final String RDF_URI = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+    private static final String RSS_URI = "http://my.netscape.com/rdf/simple/0.9/";
+    private static final String CONTENT_URI = "http://purl.org/rss/1.0/modules/content/";
+    
+    private static final Namespace RDF_NS = Namespace.getNamespace(RDF_URI);
+    private static final Namespace RSS_NS = Namespace.getNamespace(RSS_URI);
+    private static final Namespace CONTENT_NS = Namespace.getNamespace(CONTENT_URI);
+
+
+    public RSS090Parser() {
+        this("rss_0.9", RSS_NS);
+    }
+
+    protected RSS090Parser(String type, Namespace ns) {
+        super(type, ns);
+    }
+
+    public boolean isMyType(Document document) {
+        boolean ok = false;
+
+        Element rssRoot = document.getRootElement();
+        Namespace defaultNS = rssRoot.getNamespace();
+        List additionalNSs = rssRoot.getAdditionalNamespaces();
+
+        ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
+        if (ok) {
+            if (additionalNSs==null) {
+                ok = false;
+            }
+            else {
+                ok = false;
+                for (int i=0;!ok && i<additionalNSs.size();i++) {
+                    ok = getRSSNamespace().equals(additionalNSs.get(i));
+                }
+            }
+        }
+        return ok;
+    }
+
+    public WireFeed parse(Document document, boolean validate) throws IllegalArgumentException,FeedException {
+        if (validate) {
+            validateFeed(document);
+        }
+        Element rssRoot = document.getRootElement();
+        return parseChannel(rssRoot);
+    }
+
+    protected void validateFeed(Document document) throws FeedException {
+        // TBD
+        // here we have to validate the Feed against a schema or whatever
+        // not sure how to do it
+        // one posibility would be to inject our own schema for the feed (they don't exist out there)
+        // to the document, produce an ouput and attempt to parse it again with validation turned on.
+        // otherwise will have to check the document elements by hand.
+    }
+
+    /**
+     * Returns the namespace used by RSS elements in document of the RSS version the parser supports.
+     * <P>
+     * This implementation returns the EMTPY namespace.
+     * <p>
+     *
+     * @return returns the EMPTY namespace.
+     */
+    protected Namespace getRSSNamespace() {
+        return RSS_NS;
+    }
+
+    /**
+     * Returns the namespace used by RDF elements in document of the RSS version the parser supports.
+     * <P>
+     * This implementation returns the EMTPY namespace.
+     * <p>
+     *
+     * @return returns the EMPTY namespace.
+     */
+    protected Namespace getRDFNamespace() {
+        return RDF_NS;
+    }
+
+    /**
+     * Returns the namespace used by Content Module elements in document.
+     * <P>
+     * This implementation returns the EMTPY namespace.
+     * <p>
+     *
+     * @return returns the EMPTY namespace.
+     */
+    protected Namespace getContentNamespace() {
+        return CONTENT_NS;
+    }
+
+    /**
+     * Parses the root element of an RSS document into a Channel bean.
+     * <p/>
+     * It reads title, link and description and delegates to parseImage, parseItems
+     * and parseTextInput. This delegation always passes the root element of the RSS
+     * document as different RSS version may have this information in different parts
+     * of the XML tree (no assumptions made thanks to the specs variaty)
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse.
+     * @return the parsed Channel bean.
+     */
+    protected WireFeed parseChannel(Element rssRoot) {
+        Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
+
+        Channel channel = new Channel(getType());
+
+        Element e = eChannel.getChild("title",getRSSNamespace());
+        if (e!=null) {
+            channel.setTitle(e.getText());
+        }
+        e = eChannel.getChild("link",getRSSNamespace());
+        if (e!=null) {
+            channel.setLink(e.getText());
+        }
+        e = eChannel.getChild("description",getRSSNamespace());
+        if (e!=null) {
+            channel.setDescription(e.getText());
+        }
+
+        channel.setImage(parseImage(rssRoot));
+
+        channel.setTextInput(parseTextInput(rssRoot));
+
+        // Unfortunately Microsoft's SSE extension has a special case of 
+        // effectively putting the sharing channel module inside the RSS tag 
+        // and not inside the channel itself. So we also need to look for 
+        // channel modules from the root RSS element.
+        List allFeedModules = new ArrayList();
+        List rootModules = parseFeedModules(rssRoot);
+        List channelModules = parseFeedModules(eChannel); 
+        if (rootModules != null) {
+            allFeedModules.addAll(rootModules);
+        }
+        if (channelModules != null) {
+            allFeedModules.addAll(channelModules);
+        }
+        channel.setModules(allFeedModules);
+        channel.setItems(parseItems(rssRoot));
+
+        List foreignMarkup = 
+            extractForeignMarkup(eChannel, channel, getRSSNamespace());
+        if (foreignMarkup.size() > 0) {
+            channel.setForeignMarkup(foreignMarkup);
+        }          
+        return channel;
+    }
+
+
+    /**
+     * This method exists because RSS0.90 and RSS1.0 have the 'item' elements under the root elemment.
+     * And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have the item elements under the 'channel' element.
+     * <p/>
+     */
+    protected List getItems(Element rssRoot) {
+        return rssRoot.getChildren("item",getRSSNamespace());
+    }
+
+    /**
+     * This method exists because RSS0.90 and RSS1.0 have the 'image' element under the root elemment.
+     * And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have it under the 'channel' element.
+     * <p/>
+     */
+    protected Element getImage(Element rssRoot) {
+        return rssRoot.getChild("image",getRSSNamespace());
+    }
+
+    /**
+     * This method exists because RSS0.90 and RSS1.0 have the 'textinput' element under the root elemment.
+     * And RSS0.91, RSS0.02, RSS0.93, RSS0.94 and RSS2.0 have it under the 'channel' element.
+     * <p/>
+     */
+    protected Element getTextInput(Element rssRoot) {
+        return rssRoot.getChild("textinput",getRSSNamespace());
+    }
+
+    /**
+     * Parses the root element of an RSS document looking for  image information.
+     * <p/>
+     * It reads title and url out of the 'image' element.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse for image information.
+     * @return the parsed image bean.
+     */
+    protected Image parseImage(Element rssRoot) {
+        Image image = null;
+        Element eImage = getImage(rssRoot);
+        if (eImage!=null) {
+            image = new Image();
+
+            Element e = eImage.getChild("title",getRSSNamespace());
+            if (e!=null) {
+                image.setTitle(e.getText());
+            }
+            e = eImage.getChild("url",getRSSNamespace());
+            if (e!=null) {
+                image.setUrl(e.getText());
+            }
+            e = eImage.getChild("link",getRSSNamespace());
+            if (e!=null) {
+                image.setLink(e.getText());
+            }
+        }
+        return image;
+    }
+
+    /**
+     * Parses the root element of an RSS document looking for all items information.
+     * <p/>
+     * It iterates through the item elements list, obtained from the getItems() method, and invoke parseItem()
+     * for each item element. The resulting RSSItem of each item element is stored in a list.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse for all items information.
+     * @return a list with all the parsed RSSItem beans.
+     */
+    protected List parseItems(Element rssRoot)  {
+        Collection eItems = getItems(rssRoot);
+
+        List items = new ArrayList();
+        for (Iterator i=eItems.iterator();i.hasNext();) {
+            Element eItem = (Element) i.next();
+            items.add(parseItem(rssRoot,eItem));
+        }
+        return items;
+    }
+
+    /**
+     * Parses an item element of an RSS document looking for item information.
+     * <p/>
+     * It reads title and link out of the 'item' element.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document in case it's needed for context.
+     * @param eItem the item element to parse.
+     * @return the parsed RSSItem bean.
+     */
+    protected Item parseItem(Element rssRoot,Element eItem) {
+        Item item = new Item();
+        Element e = eItem.getChild("title",getRSSNamespace());
+        if (e!=null) {
+            item.setTitle(e.getText());
+        }
+        e = eItem.getChild("link",getRSSNamespace());
+        if (e!=null) {
+            item.setLink(e.getText());
+            item.setUri(e.getText());
+        }
+        
+        item.setModules(parseItemModules(eItem));
+                
+        List foreignMarkup = 
+            extractForeignMarkup(eItem, item, getRSSNamespace());
+        //content:encoded elements are treated special, without a module, they have to be removed from the foreign
+        //markup to avoid duplication in case of read/write. Note that this fix will break if a content module is
+        //used
+        Iterator iterator = foreignMarkup.iterator();
+        while (iterator.hasNext()) {
+            Element ie = (Element)iterator.next();
+            if (getContentNamespace().equals(ie.getNamespace()) && ie.getName().equals("encoded")) {
+                iterator.remove();
+            }
+        }
+        if (foreignMarkup.size() > 0) {
+            item.setForeignMarkup(foreignMarkup);
+        }
+        return item;
+    }
+
+
+    /**
+     * Parses the root element of an RSS document looking for  text-input information.
+     * <p/>
+     * It reads title, description, name and link out of the 'textinput' or 'textInput' element.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse for text-input information.
+     * @return the parsed RSSTextInput bean.
+     */
+    protected TextInput parseTextInput(Element rssRoot) {
+        TextInput textInput = null;
+        Element eTextInput = getTextInput(rssRoot);
+        if (eTextInput!=null) {
+            textInput = new TextInput();
+            Element e = eTextInput.getChild("title",getRSSNamespace());
+            if (e!=null) {
+                textInput.setTitle(e.getText());
+            }
+            e = eTextInput.getChild("description",getRSSNamespace());
+            if (e!=null) {
+                textInput.setDescription(e.getText());
+            }
+            e = eTextInput.getChild("name",getRSSNamespace());
+            if (e!=null) {
+                textInput.setName(e.getText());
+            }
+            e = eTextInput.getChild("link",getRSSNamespace());
+            if (e!=null) {
+                textInput.setLink(e.getText());
+            }
+        }
+        return textInput;
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeGenerator.java
new file mode 100644
index 0000000..e86cd2c
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeGenerator.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import org.jdom2.DocType;
+import org.jdom2.Document;
+import org.jdom2.Element;
+
+/**
+ * Feed Generator for RSS 0.91
+ * <p/>
+ *
+ * @author Elaine Chien
+ *
+ */
+public class RSS091NetscapeGenerator extends RSS091UserlandGenerator {
+    private String _version;
+
+    public RSS091NetscapeGenerator() {
+        this("rss_0.91N","0.91");
+    }
+
+    protected RSS091NetscapeGenerator(String type,String version) {
+        super(type,version);
+    }
+
+    protected Document createDocument(Element root) {
+        Document doc = new Document(root);
+        DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME,
+                                      RSS091NetscapeParser.PUBLIC_ID,
+                                      RSS091NetscapeParser.SYSTEM_ID);
+        doc.setDocType(docType);
+        return doc;
+    }
+
+    protected String getTextInputLabel() {
+        return "textinput";
+    }
+
+    /**
+     * To be overriden by RSS 0.91 Netscape and RSS 0.94
+     */
+    protected boolean isHourFormat24() {
+        return false;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeParser.java
new file mode 100644
index 0000000..5de4b7f
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091NetscapeParser.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import org.jdom2.*;
+
+/**
+ */
+public class RSS091NetscapeParser extends RSS091UserlandParser {
+
+    public RSS091NetscapeParser() {
+        this("rss_0.91N");
+    }
+
+    protected RSS091NetscapeParser(String type) {
+        super(type);
+    }
+
+    static final String ELEMENT_NAME = "rss";
+    static final String PUBLIC_ID = "-//Netscape Communications//DTD RSS 0.91//EN";
+    static final String SYSTEM_ID = "http://my.netscape.com/publish/formats/rss-0.91.dtd";
+
+    public boolean isMyType(Document document) {
+        boolean ok = false;
+        Element rssRoot = document.getRootElement();
+        ok = rssRoot.getName().equals("rss");
+        if (ok) {
+            ok = false;
+            Attribute version = rssRoot.getAttribute("version");
+            if (version!=null) {
+                ok = version.getValue().equals(getRSSVersion());
+                if (ok) {
+                    ok = false;
+                    DocType docType = document.getDocType();
+
+                    if (docType!=null) {
+                        ok = ELEMENT_NAME.equals(docType.getElementName());
+                        ok = ok && PUBLIC_ID.equals(docType.getPublicID());
+                        ok = ok && SYSTEM_ID.equals(docType.getSystemID());
+                    }
+                }
+            }
+        }
+        return ok;
+    }
+
+    protected boolean isHourFormat24(Element rssRoot) {
+        return false;
+    }
+
+    protected String getTextInputLabel() {
+        return "textinput";
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
new file mode 100644
index 0000000..d83cb05
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandGenerator.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Description;
+import com.sun.syndication.feed.rss.Image;
+import com.sun.syndication.feed.rss.Item;
+import com.sun.syndication.io.FeedException;
+
+import org.jdom2.Attribute;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
+
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * Feed Generator for RSS 0.91
+ * <p/>
+ *
+ * @author Elaine Chien
+ *
+ */
+public class RSS091UserlandGenerator extends RSS090Generator {
+    private String _version;
+
+    public RSS091UserlandGenerator() {
+        this("rss_0.91U", "0.91");
+    }
+
+    protected RSS091UserlandGenerator(String type, String version) {
+        super(type);
+        _version = version;
+    }
+
+    protected Namespace getFeedNamespace() {
+        return Namespace.NO_NAMESPACE;
+    }
+
+    /**
+     * To be overriden by RSS 0.91 Netscape and RSS 0.94
+     */
+    protected boolean isHourFormat24() {
+        return true;
+    }
+
+    protected String getVersion() {
+        return _version;
+    }
+
+    protected void addChannel(Channel channel, Element parent)
+        throws FeedException {
+        super.addChannel(channel, parent);
+
+        Element eChannel = parent.getChild("channel", getFeedNamespace());
+
+        addImage(channel, eChannel);
+        addTextInput(channel, eChannel);
+        addItems(channel, eChannel);
+    }
+
+    protected void checkChannelConstraints(Element eChannel)
+        throws FeedException {
+        checkNotNullAndLength(eChannel, "title", 1, 100);
+        checkNotNullAndLength(eChannel, "description", 1, 500);
+        checkNotNullAndLength(eChannel, "link", 1, 500);
+        checkNotNullAndLength(eChannel, "language", 2, 5);
+
+        checkLength(eChannel, "rating", 20, 500);
+        checkLength(eChannel, "copyright", 1, 100);
+        checkLength(eChannel, "pubDate", 1, 100);
+        checkLength(eChannel, "lastBuildDate", 1, 100);
+        checkLength(eChannel, "docs", 1, 500);
+        checkLength(eChannel, "managingEditor", 1, 100);
+        checkLength(eChannel, "webMaster", 1, 100);
+
+        Element skipHours = eChannel.getChild("skipHours");
+
+        if (skipHours != null) {
+            List hours = skipHours.getChildren();
+
+            for (int i = 0; i < hours.size(); i++) {
+                Element hour = (Element) hours.get(i);
+                int value = Integer.parseInt(hour.getText().trim());
+
+                if (isHourFormat24()) {
+                    if ((value < 1) || (value > 24)) {
+                        throw new FeedException("Invalid hour value " + value + ", it must be between 1 and 24");
+                    }
+                } else {
+                    if ((value < 0) || (value > 23)) {
+                        throw new FeedException("Invalid hour value " + value + ", it must be between 0 and 23");
+                    }
+                }
+            }
+        }
+    }
+
+    protected void checkImageConstraints(Element eImage)
+        throws FeedException {
+        checkNotNullAndLength(eImage, "title", 1, 100);
+        checkNotNullAndLength(eImage, "url", 1, 500);
+
+        checkLength(eImage, "link", 1, 500);
+        checkLength(eImage, "width", 1, 3);
+        checkLength(eImage, "width", 1, 3);
+        checkLength(eImage, "description", 1, 100);
+    }
+
+    protected void checkItemConstraints(Element eItem)
+        throws FeedException {
+        checkNotNullAndLength(eItem, "title", 1, 100);
+        checkNotNullAndLength(eItem, "link", 1, 500);
+
+        checkLength(eItem, "description", 1, 500);
+    }
+
+    protected void checkTextInputConstraints(Element eTextInput)
+        throws FeedException {
+        checkNotNullAndLength(eTextInput, "title", 1, 100);
+        checkNotNullAndLength(eTextInput, "description", 1, 500);
+        checkNotNullAndLength(eTextInput, "name", 1, 20);
+        checkNotNullAndLength(eTextInput, "link", 1, 500);
+    }
+
+    protected Document createDocument(Element root) {
+        return new Document(root);
+    }
+
+    protected Element createRootElement(Channel channel) {
+        Element root = new Element("rss", getFeedNamespace());
+        Attribute version = new Attribute("version", getVersion());
+        root.setAttribute(version);
+        root.addNamespaceDeclaration(getContentNamespace());
+        generateModuleNamespaceDefs(root);
+
+        return root;
+    }
+
+    protected Element generateSkipDaysElement(List days) {
+        Element skipDaysElement = new Element("skipDays");
+
+        for (int i = 0; i < days.size(); i++) {
+            skipDaysElement.addContent(generateSimpleElement("day", days.get(i).toString()));
+        }
+
+        return skipDaysElement;
+    }
+
+    protected Element generateSkipHoursElement(List hours) {
+        Element skipHoursElement = new Element("skipHours", getFeedNamespace());
+
+        for (int i = 0; i < hours.size(); i++) {
+            skipHoursElement.addContent(generateSimpleElement("hour", hours.get(i).toString()));
+        }
+
+        return skipHoursElement;
+    }
+
+    protected void populateChannel(Channel channel, Element eChannel) {
+        super.populateChannel(channel, eChannel);
+
+        String language = channel.getLanguage();
+
+        if (language != null) {
+            eChannel.addContent(generateSimpleElement("language", language));
+        }
+
+        String rating = channel.getRating();
+
+        if (rating != null) {
+            eChannel.addContent(generateSimpleElement("rating", rating));
+        }
+
+        String copyright = channel.getCopyright();
+
+        if (copyright != null) {
+            eChannel.addContent(generateSimpleElement("copyright", copyright));
+        }
+
+        Date pubDate = channel.getPubDate();
+
+        if (pubDate != null) {
+            eChannel.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate)));
+        }
+
+        Date lastBuildDate = channel.getLastBuildDate();
+
+        if (lastBuildDate != null) {
+            eChannel.addContent(generateSimpleElement("lastBuildDate", DateParser.formatRFC822(lastBuildDate)));
+        }
+
+        String docs = channel.getDocs();
+
+        if (docs != null) {
+            eChannel.addContent(generateSimpleElement("docs", docs));
+        }
+
+        String managingEditor = channel.getManagingEditor();
+
+        if (managingEditor != null) {
+            eChannel.addContent(generateSimpleElement("managingEditor", managingEditor));
+        }
+
+        String webMaster = channel.getWebMaster();
+
+        if (webMaster != null) {
+            eChannel.addContent(generateSimpleElement("webMaster", webMaster));
+        }
+
+        List skipHours = channel.getSkipHours();
+
+        if ((skipHours != null) && (skipHours.size() > 0)) {
+            eChannel.addContent(generateSkipHoursElement(skipHours));
+        }
+
+        List skipDays = channel.getSkipDays();
+
+        if ((skipDays != null) && (skipDays.size() > 0)) {
+            eChannel.addContent(generateSkipDaysElement(skipDays));
+        }
+    }
+
+    protected void populateFeed(Channel channel, Element parent)
+        throws FeedException {
+        addChannel(channel, parent);
+    }
+
+    protected void populateImage(Image image, Element eImage) {
+        super.populateImage(image, eImage);
+
+        Integer width = image.getWidth();
+
+        if (width != null) {
+            eImage.addContent(generateSimpleElement("width", String.valueOf(width)));
+        }
+
+        Integer height = image.getHeight();
+
+        if (height != null) {
+            eImage.addContent(generateSimpleElement("height", String.valueOf(height)));
+        }
+
+        String description = image.getDescription();
+
+        if (description != null) {
+            eImage.addContent(generateSimpleElement("description", description));
+        }
+    }
+
+    protected void populateItem(Item item, Element eItem, int index) {
+        super.populateItem(item, eItem, index);
+
+        Description description = item.getDescription();
+
+        if (description != null) {
+            eItem.addContent(generateSimpleElement("description", description.getValue()));
+        }
+
+        if ((item.getModule(getContentNamespace().getURI()) == null) && (item.getContent() != null)) {
+            Element elem = new Element("encoded", getContentNamespace());
+            elem.addContent(item.getContent().getValue());
+            eItem.addContent(elem);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
new file mode 100644
index 0000000..86a0157
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS091UserlandParser.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Content;
+import com.sun.syndication.feed.rss.Description;
+import com.sun.syndication.feed.rss.Image;
+import com.sun.syndication.feed.rss.Item;
+import org.jdom2.Attribute;
+import org.jdom2.Document;
+import org.jdom2.Element;
+import org.jdom2.Namespace;
+
+import java.util.*;
+
+/**
+ */
+public class RSS091UserlandParser extends RSS090Parser {
+
+    public RSS091UserlandParser() {
+        this("rss_0.91U");
+    }
+
+    protected RSS091UserlandParser(String type) {
+        super(type, null);
+    }
+
+    public boolean isMyType(Document document) {
+        boolean ok;
+        Element rssRoot = document.getRootElement();
+        ok = rssRoot.getName().equals("rss");
+        if (ok) {
+            ok = false;
+            Attribute version = rssRoot.getAttribute("version");
+            if (version!=null) {
+                ok = version.getValue().equals(getRSSVersion());
+            }
+        }
+        return ok;
+    }
+
+    protected String getRSSVersion() {
+            return "0.91";
+    }
+
+    protected Namespace getRSSNamespace() {
+        return Namespace.getNamespace("");
+    }
+
+    /**
+     * To be overriden by RSS 0.91 Netscape and RSS 0.94
+     */
+    protected boolean isHourFormat24(Element rssRoot) {
+        return true;
+    }
+
+    /**
+     * Parses the root element of an RSS document into a Channel bean.
+     * <p/>
+     * It first invokes super.parseChannel and then parses and injects the following
+     * properties if present: language, pubDate, rating and copyright.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse.
+     * @return the parsed Channel bean.
+     */
+    protected WireFeed parseChannel(Element rssRoot)  {
+        Channel channel = (Channel) super.parseChannel(rssRoot);
+
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+
+        Element e = eChannel.getChild("language",getRSSNamespace());
+        if (e!=null) {
+            channel.setLanguage(e.getText());
+        }
+        e = eChannel.getChild("rating",getRSSNamespace());
+        if (e!=null) {
+            channel.setRating(e.getText());
+        }
+        e = eChannel.getChild("copyright",getRSSNamespace());
+        if (e!=null) {
+            channel.setCopyright(e.getText());
+        }
+        e = eChannel.getChild("pubDate",getRSSNamespace());
+        if (e!=null) {
+            channel.setPubDate(DateParser.parseDate(e.getText()));
+        }
+        e = eChannel.getChild("lastBuildDate",getRSSNamespace());
+        if (e!=null) {
+            channel.setLastBuildDate(DateParser.parseDate(e.getText()));
+        }
+        e = eChannel.getChild("docs",getRSSNamespace());
+        if (e!=null) {
+            channel.setDocs(e.getText());
+        }
+        e = eChannel.getChild("docs",getRSSNamespace());
+        if (e!=null) {
+            channel.setDocs(e.getText());
+        }
+        e = eChannel.getChild("managingEditor",getRSSNamespace());
+        if (e!=null) {
+            channel.setManagingEditor(e.getText());
+        }
+        e = eChannel.getChild("webMaster",getRSSNamespace());
+        if (e!=null) {
+            channel.setWebMaster(e.getText());
+        }
+        e = eChannel.getChild("skipHours");
+        if (e!=null) {
+            List skipHours = new ArrayList();
+            List eHours = e.getChildren("hour",getRSSNamespace());
+            for (int i=0;i<eHours.size();i++) {
+                Element eHour = (Element) eHours.get(i);
+                skipHours.add(new Integer(eHour.getText().trim()));
+            }
+            channel.setSkipHours(skipHours);
+        }
+
+        e = eChannel.getChild("skipDays");
+        if (e!=null) {
+            List skipDays = new ArrayList();
+            List eDays = e.getChildren("day",getRSSNamespace());
+            for (int i=0;i<eDays.size();i++) {
+                Element eDay = (Element) eDays.get(i);
+                skipDays.add(eDay.getText().trim());
+            }
+            channel.setSkipDays(skipDays);
+        }
+        return channel;
+    }
+
+    /**
+     * Parses the root element of an RSS document looking for  image information.
+     * <p/>
+     * It first invokes super.parseImage and then parses and injects the following
+     * properties if present: url, link, width, height and description.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document to parse for image information.
+     * @return the parsed RSSImage bean.
+     */
+    protected Image parseImage(Element rssRoot) {
+        Image image = super.parseImage(rssRoot);
+        if (image!=null) {
+            Element eImage = getImage(rssRoot);
+            Element e = eImage.getChild("width",getRSSNamespace());
+            if (e!=null) {
+            	Integer val = NumberParser.parseInt(e.getText());
+            	if (val != null) {
+            		image.setWidth(val.intValue());
+            	}                
+            }
+            e = eImage.getChild("height",getRSSNamespace());
+            if (e!=null) {
+            	Integer val = NumberParser.parseInt(e.getText());
+            	if (val != null) {
+            		image.setHeight(val.intValue());
+            	}
+            }
+            e = eImage.getChild("description",getRSSNamespace());
+            if (e!=null) {
+                image.setDescription(e.getText());
+            }
+        }
+        return image;
+    }
+
+
+    /**
+     * It looks for the 'item' elements under the 'channel' elemment.
+     */
+    protected List getItems(Element rssRoot) {
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+        return (eChannel!=null) ? eChannel.getChildren("item",getRSSNamespace()) : Collections.EMPTY_LIST;
+    }
+
+    /**
+     * It looks for the 'image' elements under the 'channel' elemment.
+     */
+    protected Element getImage(Element rssRoot) {
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+        return (eChannel!=null) ? eChannel.getChild("image",getRSSNamespace()) : null;
+    }
+
+    /**
+     * To be overriden by RSS 0.91 Netscape parser
+     */
+    protected String getTextInputLabel() {
+        return "textInput";
+    }
+
+    /**
+     * It looks for the 'textinput' elements under the 'channel' elemment.
+     */
+    protected Element getTextInput(Element rssRoot) {
+        String elementName = getTextInputLabel();
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+        return (eChannel!=null) ? eChannel.getChild(elementName,getRSSNamespace()) : null;
+    }
+
+    /**
+     * Parses an item element of an RSS document looking for item information.
+     * <p/>
+     * It first invokes super.parseItem and then parses and injects the description property if present.
+     * <p/>
+     *
+     * @param rssRoot the root element of the RSS document in case it's needed for context.
+     * @param eItem the item element to parse.
+     * @return the parsed RSSItem bean.
+     */
+    protected Item parseItem(Element rssRoot, Element eItem) {
+        Item item = super.parseItem(rssRoot,eItem);
+        Element e = eItem.getChild("description", getRSSNamespace());
+        if (e!=null) {
+            item.setDescription(parseItemDescription(rssRoot,e));
+        }
+        Element ce = eItem.getChild("encoded", getContentNamespace());
+        if (ce != null) {
+            Content content = new Content();
+            content.setType(Content.HTML);
+            content.setValue(ce.getText());
+            item.setContent(content);
+        }
+        return item;
+    }
+
+    protected Description parseItemDescription(Element rssRoot,Element eDesc) {
+        Description desc = new Description();
+        desc.setType("text/plain");
+        desc.setValue(eDesc.getText());
+        return desc;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
new file mode 100644
index 0000000..12a03d5
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Generator.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.rss.*;
+import com.sun.syndication.io.FeedException;
+import org.jdom2.Attribute;
+import org.jdom2.Element;
+
+import java.util.List;
+
+
+/**
+ * Feed Generator for RSS 0.92
+ * <p/>
+ *
+ * @author Elaine Chien
+ *
+ */
+
+public class RSS092Generator extends RSS091UserlandGenerator {
+
+    public RSS092Generator() {
+        this("rss_0.92","0.92");
+    }
+
+    protected RSS092Generator(String type,String version) {
+        super(type,version);
+    }
+
+    protected void populateChannel(Channel channel,Element eChannel) {
+        super.populateChannel(channel,eChannel);
+
+        Cloud cloud = channel.getCloud();
+        if (cloud!=null) {
+            eChannel.addContent(generateCloud(cloud));
+        }
+    }
+
+    protected Element generateCloud(Cloud cloud) {
+        Element eCloud = new Element("cloud",getFeedNamespace());
+
+        if (cloud.getDomain() != null) {
+            eCloud.setAttribute(new Attribute("domain", cloud.getDomain()));
+        }
+
+        if (cloud.getPort() != 0) {
+            eCloud.setAttribute(new Attribute("port", String.valueOf(cloud.getPort())));
+        }
+
+        if (cloud.getPath() != null) {
+            eCloud.setAttribute(new Attribute("path", cloud.getPath()));
+        }
+
+        if (cloud.getRegisterProcedure() != null) {
+            eCloud.setAttribute(new Attribute("registerProcedure", cloud.getRegisterProcedure()));
+        }
+
+        if (cloud.getProtocol() != null) {
+            eCloud.setAttribute(new Attribute("protocol", cloud.getProtocol()));
+        }
+        return eCloud;
+    }
+
+    // Another one to thanks DW for
+    protected int getNumberOfEnclosures(List enclosures) {
+        return (enclosures.size()>0) ? 1 : 0;
+    }
+
+    protected void populateItem(Item item, Element eItem, int index) {
+        super.populateItem(item,eItem, index);
+
+        Source source =item.getSource();
+        if (source != null) {
+            eItem.addContent(generateSourceElement(source));
+        }
+
+        List enclosures = item.getEnclosures();
+        for(int i = 0; i < getNumberOfEnclosures(enclosures); i++) {
+            eItem.addContent(generateEnclosure((Enclosure)enclosures.get(i)));
+        }
+
+        List categories = item.getCategories();
+        for(int i = 0; i < categories.size(); i++) {
+            eItem.addContent(generateCategoryElement((Category)categories.get(i)));
+        }
+    }
+
+    protected Element generateSourceElement(Source source) {
+        Element sourceElement = new Element("source",getFeedNamespace());
+        if (source.getUrl() != null) {
+            sourceElement.setAttribute(new Attribute("url", source.getUrl()));
+        }
+        sourceElement.addContent(source.getValue());
+        return sourceElement;
+    }
+
+    protected Element generateEnclosure(Enclosure enclosure) {
+        Element enclosureElement = new Element("enclosure",getFeedNamespace());
+        if (enclosure.getUrl() != null) {
+            enclosureElement.setAttribute("url", enclosure.getUrl());
+        }
+        if (enclosure.getLength() != 0) {
+            enclosureElement.setAttribute("length", String.valueOf(enclosure.getLength()));
+        }
+        if (enclosure.getType() != null) {
+            enclosureElement.setAttribute("type", enclosure.getType());
+        }
+        return enclosureElement;
+    }
+
+    protected Element generateCategoryElement(Category category) {
+        Element categoryElement = new Element("category",getFeedNamespace());
+        if (category.getDomain() != null) {
+            categoryElement.setAttribute("domain", category.getDomain());
+        }
+        categoryElement.addContent(category.getValue());
+        return categoryElement;
+    }
+
+
+    protected void checkChannelConstraints(Element eChannel) throws FeedException {
+        checkNotNullAndLength(eChannel,"title", 0, -1);
+        checkNotNullAndLength(eChannel,"description", 0, -1);
+        checkNotNullAndLength(eChannel,"link", 0, -1);
+    }
+
+    protected void checkImageConstraints(Element eImage) throws FeedException {
+        checkNotNullAndLength(eImage,"title", 0, -1);
+        checkNotNullAndLength(eImage,"url", 0, -1);
+    }
+
+    protected void checkTextInputConstraints(Element eTextInput) throws FeedException {
+        checkNotNullAndLength(eTextInput,"title", 0, -1);
+        checkNotNullAndLength(eTextInput,"description", 0, -1);
+        checkNotNullAndLength(eTextInput,"name", 0, -1);
+        checkNotNullAndLength(eTextInput,"link", 0, -1);
+    }
+
+    protected void checkItemsConstraints(Element parent) throws FeedException {
+    }
+
+    protected void checkItemConstraints(Element eItem) throws FeedException {
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
new file mode 100644
index 0000000..9eacee7
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS092Parser.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.rss.Category;
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Cloud;
+import com.sun.syndication.feed.rss.Description;
+import com.sun.syndication.feed.rss.Enclosure;
+import com.sun.syndication.feed.rss.Item;
+import com.sun.syndication.feed.rss.Source;
+import org.jdom2.Element;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ */
+public class RSS092Parser extends RSS091UserlandParser {
+
+    public RSS092Parser() {
+        this("rss_0.92");
+    }
+
+    protected RSS092Parser(String type) {
+        super(type);
+    }
+
+    protected String getRSSVersion() {
+            return "0.92";
+    }
+
+    protected WireFeed parseChannel(Element rssRoot)  {
+        Channel channel = (Channel) super.parseChannel(rssRoot);
+
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+        Element eCloud = eChannel.getChild("cloud",getRSSNamespace());
+        if (eCloud!=null) {
+            Cloud cloud = new Cloud();
+            String att = eCloud.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                cloud.setDomain(att);
+            }
+            att = eCloud.getAttributeValue("port");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                cloud.setPort(Integer.parseInt(att.trim()));
+            }
+            att = eCloud.getAttributeValue("path");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                cloud.setPath(att);
+            }
+            att = eCloud.getAttributeValue("registerProcedure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                cloud.setRegisterProcedure(att);
+            }
+            att = eCloud.getAttributeValue("protocol");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                cloud.setProtocol(att);
+            }
+            channel.setCloud(cloud);
+        }
+        return channel;
+    }
+
+    protected Item parseItem(Element rssRoot,Element eItem) {
+        Item item = super.parseItem(rssRoot,eItem);
+
+        Element e = eItem.getChild("source",getRSSNamespace());
+        if (e!=null) {
+            Source source = new Source();
+            String url = e.getAttributeValue("url");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            source.setUrl(url);
+            source.setValue(e.getText());
+            item.setSource(source);
+        }
+
+        // 0.92 allows one enclosure occurrence, 0.93 multiple
+        // just saving to write some code.
+        List eEnclosures = eItem.getChildren("enclosure");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+        if (eEnclosures.size()>0) {
+            List enclosures = new ArrayList();
+            for (int i=0;i<eEnclosures.size();i++) {
+                e = (Element) eEnclosures.get(i);
+
+                Enclosure enclosure = new Enclosure();
+                String att = e.getAttributeValue("url");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+                if (att!=null) {
+                    enclosure.setUrl(att);
+                }
+                att = e.getAttributeValue("length");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+                enclosure.setLength(NumberParser.parseLong(att,0L));
+
+                att = e.getAttributeValue("type");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+                if (att!=null) {
+                    enclosure.setType(att);
+                }
+                enclosures.add(enclosure);
+            }
+            item.setEnclosures(enclosures);
+        }
+
+        List eCats = eItem.getChildren("category");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+        item.setCategories(parseCategories(eCats));
+
+        return item;
+    }
+
+    protected List parseCategories(List eCats) {
+        List cats = null;
+        if (eCats.size()>0) {
+            cats = new ArrayList();
+            for (int i=0;i<eCats.size();i++) {
+                Category cat = new Category();
+                Element e = (Element) eCats.get(i);
+                String att = e.getAttributeValue("domain");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+                if (att!=null) {
+                    cat.setDomain(att);
+                }
+                cat.setValue(e.getText());
+                cats.add(cat);
+            }
+        }
+        return cats;
+    }
+
+    protected Description parseItemDescription(Element rssRoot,Element eDesc) {
+        Description desc = super.parseItemDescription(rssRoot,eDesc);
+        desc.setType("text/html");
+        return desc;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Generator.java
new file mode 100644
index 0000000..d0c5bee
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Generator.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.rss.Item;
+import org.jdom2.Element;
+
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * Feed Generator for RSS 0.93
+ * <p/>
+ *
+ * @author Elaine Chien
+ *
+ */
+public class RSS093Generator extends RSS092Generator {
+
+    public RSS093Generator() {
+        this("rss_0.93","0.93");
+    }
+
+    protected RSS093Generator(String feedType,String version) {
+        super(feedType,version);
+    }
+
+    protected void populateItem(Item item, Element eItem, int index) {
+        super.populateItem(item,eItem, index);
+
+        Date pubDate = item.getPubDate();
+        if (pubDate != null) {
+            eItem.addContent(generateSimpleElement("pubDate", DateParser.formatRFC822(pubDate)));
+        }
+
+        Date expirationDate = item.getExpirationDate();
+        if (expirationDate != null) {
+            eItem.addContent(generateSimpleElement("expirationDate", DateParser.formatRFC822(expirationDate)));
+        }
+    }
+
+    // Another one to thanks DW for
+    protected int getNumberOfEnclosures(List enclosures) {
+        return enclosures.size();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Parser.java
new file mode 100644
index 0000000..f5aaaee
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS093Parser.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.rss.Item;
+import org.jdom2.Element;
+
+/**
+ */
+public class RSS093Parser extends RSS092Parser {
+
+    public RSS093Parser() {
+        this("rss_0.93");
+    }
+
+    protected RSS093Parser(String type) {
+        super(type);
+    }
+
+    protected String getRSSVersion() {
+            return "0.93";
+    }
+
+    protected Item parseItem(Element rssRoot,Element eItem) {
+        Item item = super.parseItem(rssRoot,eItem);
+        Element e = eItem.getChild("pubDate",getRSSNamespace());
+        if (e!=null) {
+            item.setPubDate(DateParser.parseDate(e.getText()));
+        }
+        e = eItem.getChild("expirationDate",getRSSNamespace());
+        if (e!=null) {
+            item.setExpirationDate(DateParser.parseDate(e.getText()));
+        }
+        e = eItem.getChild("description",getRSSNamespace());
+        if (e!=null) {
+            String type = e.getAttributeValue("type");
+            if (type!=null) {
+                item.getDescription().setType(type);
+            }
+        }
+        return item;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Generator.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Generator.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Generator.java
new file mode 100644
index 0000000..5009beb
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Generator.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.rss.Description;
+import com.sun.syndication.feed.rss.Item;
+import org.jdom2.Attribute;
+import org.jdom2.Element;
+
+/**
+ * Feed Generator for RSS 0.94
+ * <p/>
+ *
+ * @author Elaine Chien
+ *
+ */
+
+public class RSS094Generator extends RSS093Generator {
+
+    public RSS094Generator() {
+        this("rss_0.94","0.94");
+    }
+
+    protected RSS094Generator(String feedType,String version) {
+        super(feedType,version);
+    }
+
+    protected void populateItem(Item item, Element eItem, int index) {
+        super.populateItem(item,eItem, index);
+
+        Description description = item.getDescription();
+        if (description!=null && description.getType()!=null) {
+            Element eDescription = eItem.getChild("description",getFeedNamespace());
+            eDescription.setAttribute(new Attribute("type",description.getType()));
+        }
+        eItem.removeChild("expirationDate",getFeedNamespace());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/marmotta/blob/00c22e7c/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
----------------------------------------------------------------------
diff --git a/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
new file mode 100644
index 0000000..61c5c86
--- /dev/null
+++ b/commons/marmotta-sesame-tools/marmotta-rio-rss/src/ext/java/com/sun/syndication/io/impl/RSS094Parser.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2004 Sun Microsystems, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package com.sun.syndication.io.impl;
+
+import com.sun.syndication.feed.WireFeed;
+import com.sun.syndication.feed.rss.Channel;
+import com.sun.syndication.feed.rss.Description;
+import com.sun.syndication.feed.rss.Guid;
+import com.sun.syndication.feed.rss.Item;
+import org.jdom2.Element;
+
+import java.util.List;
+
+/**
+ */
+public class RSS094Parser extends RSS093Parser {
+
+    public RSS094Parser() {
+        this("rss_0.94");
+    }
+
+    protected RSS094Parser(String type) {
+        super(type);
+    }
+
+    protected String getRSSVersion() {
+            return "0.94";
+    }
+
+    protected WireFeed parseChannel(Element rssRoot)  {
+        Channel channel = (Channel) super.parseChannel(rssRoot);
+        Element eChannel = rssRoot.getChild("channel",getRSSNamespace());
+
+        List eCats = eChannel.getChildren("category",getRSSNamespace());
+        channel.setCategories(parseCategories(eCats));
+
+        Element eTtl = eChannel.getChild("ttl",getRSSNamespace());
+        if (eTtl!=null && eTtl.getText() != null ) {
+            Integer ttlValue = null;        
+            try{
+                 ttlValue = new Integer(eTtl.getText());
+            } catch(NumberFormatException nfe ){ 
+                ; //let it go by
+            }
+            if (ttlValue != null) {
+                channel.setTtl(ttlValue.intValue());
+            }
+        }
+
+        return channel;
+    }
+
+    public Item parseItem(Element rssRoot,Element eItem) {
+        Item item = super.parseItem(rssRoot,eItem);
+        item.setExpirationDate(null);
+
+        Element e = eItem.getChild("author",getRSSNamespace());
+        if (e!=null) {
+            item.setAuthor(e.getText());
+        }
+
+        e = eItem.getChild("guid",getRSSNamespace());
+        if (e!=null) {
+            Guid guid = new Guid();
+            String att = e.getAttributeValue("isPermaLink");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+            if (att!=null) {
+                guid.setPermaLink(att.equalsIgnoreCase("true"));
+            }
+            guid.setValue(e.getText());
+            item.setGuid(guid);
+        }
+
+        e = eItem.getChild("comments",getRSSNamespace());
+        if (e!=null) {
+            item.setComments(e.getText());
+        }
+
+        return item;
+    }
+
+    protected Description parseItemDescription(Element rssRoot,Element eDesc) {
+        Description desc = super.parseItemDescription(rssRoot,eDesc);
+        String att = eDesc.getAttributeValue("type");//getRSSNamespace()); DONT KNOW WHY DOESN'T WORK
+        if (att==null) {
+            att = "text/html";
+        }
+        desc.setType(att);
+        return desc;
+    }
+
+}