Hello,
Working on my feed sync web service, I find a bug that I've not well
isolated: my code reads a RSS feed containing one item, with one
author element.
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:sx="
http://feedsync.org/2007/feedsync" version="2.0">
<channel>
<item>
<author>
<name>odelia</name>
</author>
<sx:sync id="SyncId1" updates="1" deleted="false"
noconflicts="false">
<sx:history sequence="1"
when="Wed, 11 Jun 2008 20:03:36 GMT" by="odelia" />
</sx:sync>
</item>
</channel>
</rss>
If I try to convert the feed to a string using DocumentHelper/
FeedWriter classes, I get an XML document with two authors element.
Here the code:
package com.odelia.feedsync;
import java.io.File;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import com.mesh4j.sync.adapters.feed.Feed;
import com.mesh4j.sync.adapters.feed.FeedReader;
import com.mesh4j.sync.adapters.feed.FeedWriter;
import com.mesh4j.sync.adapters.feed.rss.RssSyndicationFormat;
import com.mesh4j.sync.security.NullIdentityProvider;
public class Test {
/**
* @param args
* @throws DocumentException
*/
public static void main(String[] args) throws DocumentException {
FeedReader feedReader = new
FeedReader(RssSyndicationFormat.INSTANCE,
NullIdentityProvider.INSTANCE);
File fileFeed = new File("D:/feedPOST.xml");
Feed feed = feedReader.read(fileFeed);
Document document = DocumentHelper.createDocument();
FeedWriter feedWriter = new
FeedWriter(RssSyndicationFormat.INSTANCE,
NullIdentityProvider.INSTANCE);
feedWriter.write(document, feed);
System.out.println(document.asXML());
}
}
Any idea?
Thank you.
Bertrand.