Re: [Simple-support] How to create inner children without creating inner class?
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2011-01-19 10:45:42
|
Hi, Ill take a look at this, it should be possible to use namespaces with the @Path annotation. Niall --- On Tue, 18/1/11, Cristian <cri...@el...> wrote: From: Cristian <cri...@el...> Subject: Re: [Simple-support] How to create inner children without creating inner class? To: "Niall Gallagher" <gal...@ya...> Cc: sim...@li... Received: Tuesday, 18 January, 2011, 1:51 PM I wanted to do something like: <Root> <namespace:Children> <InnerChildren>SomethingM</InnerChildren> </namespace:Children> </Root> I asked on SO and got this answer: http://stackoverflow.com/questions/4715148/how-to-create-inner-children-without-creating-another-class So... in order to emulate a namespace using paths, I will have to do something like @Path("namespace:Children"). If I use the CameStyle class to format the XML, what I get is <NamespaceChildren> which is obviously wrong. Anyway, I'd be nice if the Path extension supported namespaces. Thanks. 2011/1/18 Niall Gallagher <gal...@ya...> Hi, Can you send me an example of the XML you want to generate? Niall --- On Mon, 17/1/11, Cristian <cri...@el...> wrote: From: Cristian <cri...@el...> Subject: Re: [Simple-support] How to create inner children without creating inner class? To: sim...@li... Received: Monday, 17 January, 2011, 10:07 AM All right... I see that I can accomplish that by using Paths. This way: @org.simpleframework.xml.Root class Root { @Element @Path("children") private final String innerChildren; public Root(String name){ innerChildren = name; } } The problem is that now I want to give a namespace to the path... but I have found no way to do so. If I do @Path("myns:children") I get <mynschildren> instead of <myns:children>. Thanks for you help. 2011/1/17 Cristian <cri...@el...> I need to generate an XML like this: <Root> <Children> <InnerChildren>SomethingM</InnerChildren> </Children> </Root> The simplest solution is creating an inner class on the Root class: @Root class Root{ @Element Children element; @Root private static class Children{ @Element String innerChildren; } } But I want to avoid that inner class creation, since it will make things look strange while using Root objects. Is there anyway I can achieve that result without using inner classes? -----Inline Attachment Follows----- ------------------------------------------------------------------------------ Protect Your Site and Customers from Malware Attacks Learn about various malware tactics and how to avoid them. Understand malware threats, the impact they can have on your business, and how you can protect your company and customers by using code signing. http://p.sf.net/sfu/oracle-sfdevnl -----Inline Attachment Follows----- _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |