1

I have an example that I have a List of objects inside another object like this:

the WebMethod:

public List<'Father> getFathers();

public class Father {
    private String name;

    @XmlElement(name = "child")
    @XmlElementWrapper   
    private List<Child> children;
}

public class Child {
    private String name;
}

Generating the XML:

<Father>
    <name>XXX</name>
    <Children>
        <Child>
            <name>YYY</name>
        </Child>
        <Child>
            <name>ZZZ</name>
        </Child>
    </Children>
</Father>

so far is perfect.

But, when I generate the client the Jaxb generated:

public class Father {
    private String name;
    protected Father.Children

    public static class Children {
        protected List<Child> child;
    }  
}

How can I generate the client like the original class, in others words I would like to generate this:

public class Father {
    private String name;
    private List<Child> children;
}
DT7
  • 1,615
  • 14
  • 26
  • I don't think you can do that without writing a plugin for the xjc (part of JAXB which takes care of generating Java Classes from XML Schemas), which is hell in itself, as there is very little documentation. – Xargos Oct 01 '13 at 07:18

0 Answers0