简体   繁体   中英

Getting XML String value of SyndEntry with ROME

I'm currently working on a project which implies XML feed parsing (Atom 2005) and I'm using Rome to do this.

I have some SyndEntry objects, and I need to convert them to XML as standalone Entries (not in Feeds , Entry as root element).

I looking for a way to get something like that from a SyndEntry object :

<entry xmlns="http://www.w3.org/2005/Atom">
   <title type="text">My Title</title>
   <updated>1988-01-01T00:00:00Z</updated>
   <content type="application/xml">
      ... (my content) ...
   </content>
</entry>

--> Without Feed objects.

Any help would be appreciated, thank you in advance.

Got it !

Entry entry = Atom10Parser.parseEntry(reader, "");

Then you have an Entry object. If ou want a SyndEntry object, you can do :

public class MyConverterForAtom10 extends ConverterForAtom10 {

public SyndEntry syndEntryFromEntry( Entry entry ) {
    return this.createSyndEntry(null,entry,false);
}

public Entry entryFromSyndEntry( SyndEntry syndentry ) {
    return this.createAtomEntry(syndentry);
}

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM