Re: [Simple-support] Duplicate element error parsing rss and atom
Brought to you by:
niallg
|
From: Niall G. - Y. <Nia...@yi...> - 2013-08-29 08:19:09
|
I think you should easily be able to try this yourself, however a Converter can also deserialize as well as serialize. I may consider adding something that would pair an @Namespace with an @Element to extract a prefixed/qualified element. -----Original Message----- From: terry turner [mailto:tn...@na...] Sent: Thursday, 29 August 2013 9:19 AM To: Niall Gallagher Cc: sim...@li... Subject: Re: [Simple-support] Duplicate element error parsing rss and atom the converter looks like it can only be used for serialization. my problem is deserialization. although that is how the xml spec is defined the problem for a xml-object mapping library is that we need a way to map these elements to different fields in the object based on the namespace they are part of. with most xml i've worked with the parties communicating work closely together and these sorts of namespace issues can be avoided. in the case of rss it is a free for all. the people producing the xml do on a 'take it or leave it' basis and those parsing are left to figure out how to do it. my choice is to preprocess the xml or charge the library so that it'll handle these collisions. if you think a novice (to the library) could modify the library source to handle this i'm happy to give it a try. thanks, terry On 08/28/2013 01:17 AM, Niall Gallagher wrote: > One thing to note, is that namespaces do not form part of the document > structure according to the XML specification so <x:link> <y:link> > <z:link> are all just <link> the namespace only qualifies it. Use an > @ElementList with inline=true and it will pick up both links, you can > then use the one that you want. Alternatively you can parse it > yourself with a Converter. > > ---------------------------------------------------------------------- > -- > *From:* terry turner <tn...@na...> > *To:* sim...@li... > *Sent:* Wednesday, 28 August 2013 5:47 PM > *Subject:* [Simple-support] Duplicate element error parsing rss and > atom > > this is a well designed api but i'm having what seems to be a common > problem deserializing xml that contains elements with the same name > but in different name spaces. the usual example is > > <rss > > <channel> > ... > <link>some value</link> > ... > <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" > rel="self" > type="application/rss+xml" > href="http://feeds.feedburner.com/..."/> > > the 'link' in <atom:link> collides with <link> > > first question: is there any way to parse this with the current > version of simpleXml? > > as no one that has asked this question has received an answer i'm > assuming there is no way to do it now. that leads to my second question: > how hard is this to support? is it something that an above average > java developer (that's me) could get done relatively quickly? > > or is it a big design change to support these name space name collisions? > > thanks, > terry > > ---------------------------------------------------------------------- > -------- Learn the latest--Visual Studio 2012, SharePoint 2013, SQL > 2012, more! > Discover the easy way to master current and previous Microsoft > technologies and advance your career. Get an incredible 1,500+ hours > of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.c > lktrk _______________________________________________ > Simple-support mailing list > Sim...@li... > <mailto:Sim...@li...> > https://lists.sourceforge.net/lists/listinfo/simple-support > > ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |