Re: [Simple-support] How to create inner children without creating inner class?
Brought to you by:
niallg
|
From: Cristian <cri...@el...> - 2011-01-17 18:07:41
|
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?
>
|