Re: [Simple-support] Availabily of object inlining
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-07-30 22:34:14
|
A converter can do this for you with Simple, you need to implement the org.simpleframework.xml.convert.Converter interface. Take a look at the unit tests. Its very easy to do. --- On Mon, 30/7/12, Aaron Digulla <di...@he...> wrote: > From: Aaron Digulla <di...@he...> > Subject: Re: [Simple-support] Availabily of object inlining > To: sim...@li... > Received: Monday, 30 July, 2012, 12:25 PM > Am 30.07.2012 20:20, schrieb Maxim > Solodovnik: > > Hello Niall > > > > sorry for double post > > I was able to parse "inline" object by using following > "ugly" code: > > InputNode root = NodeBuilder.read(new > FileInputStream(xml)); > > InputNode root1 = NodeBuilder.read(new > FileInputStream(xml)); //HACK to > > handle Adresses inside user > > I don't see how that could help since it reads the same file > twice > (instead of reading more nodes in the same file). > > > can you advise how can I handle duplicated element in > source XML (one > > element was printed twice by mistake) > > Yes. Remember: If something seems impossible to do, then you > might have > the wrong tool. > > So the solution in your case is that the old XML is corrupt. > To fix > this, you can: > > 1. Create a second mapping (i.e. new classes, new mappings) > and then > write a tool that create the new object structure from the > new mapping. > > 2. Use XSLT or some other simple XML transformer to convert > the old > format into the new one. > > Simple can't do this for you since it uses annotations to > configure the > parsing process and in Java, each field/class/method can > have only one > annotation. > > Regards, > > -- > Aaron "Optimizer" Digulla a.k.a. Philmann Dark > "It's not the universe that's limited, it's our > imagination. > Follow me and I'll show you something beyond the limits." > http://blog.pdark.de/ > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's > security and > threat landscape has changed and how IT managers can > respond. Discussions > will include endpoint security, mobile security and the > latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Simple-support mailing list > Sim...@li... > https://lists.sourceforge.net/lists/listinfo/simple-support > |