java - Converting SyndFeed to SyndEntry with Rome -


i'm working on project implies xml feed parsing (atom 2005) , i'm using rome this.

i have 2 kind of xml structure parse.

the first type :

<?xml version="1.0" encoding="utf-8"?> <feed     xmlns="http://www.w3.org/2005/atom"     xml:base="..." >      <id>...</id>      <title type="text" >...</title>      <entry xmlns="http://www.w3.org/2005/atom" >     <id>...</id>     </entry>      <entry xmlns="http://www.w3.org/2005/atom" >     <id>...</id>     </entry>      ... </feed> 

(one feed, containing several entries)

the second type :

<?xml version="1.0" encoding="utf-8"?>  <entry xmlns="http://www.w3.org/2005/atom" >     <id>...</id> </entry> 

(one entry, not contained in "feed")

my objective make bean "myentry" parse input xml , information. ideal have 1 constructor (which takes syndentry argument example).

i did :

public myentry( syndentry e ) {     _entry = e; } 

i can "syndentry" objects when first type of xml feed :

syndfeedinput feed_input = new syndfeedinput(); ... syndfeed feed = feed_input.build(xml_file);  ( syndentry e : feed.getentries() ) {     // can syndentries here } 

--> second type of xml, there not "feed" container , can't find method build syndentry xml directly (like "syndentryinput" ?). "syndfeed" instead of "syndentry", if information remains accessible.

thus, i'm looking way convert syndfeed syndentry (or reverse), using superclass (i can't find superclass common syndentry , syndfeed) or dedicated converter.

my current solution make 2 constructors (one taking "syndfeed", , other 1 taking "syndentry"), it's quite ugly because i've method "getsynddata()" ideally returns object used construction, usefull retrieving generic info (ie: getsynddata().gettitle())

any or idea appreciated

answered myself here : getting xml string value of syndentry rome

maybe didn't asked right question


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -