Parsing abstract objects without container tag



I want to use JAXB to generate very specific XML schema and then parse the XML documents matching the schema. I have the AbstractViewElement class that is a base for everything that will show up in the XML. Then there's Layout class and widgets:



public class Layout extends AbstractViewElement {
private List<AbstractViewElement> children;
...
}

public class TextField extends AbstractViewElement {
...
}

public class Button extends AbstractViewElement {
...
}


Now, I want to be able to parse XML documents that look more or less like this:



<ucl:Layout>
<ucl:Button/>
<ucl:TextField/>
</ucl:Layout>


So, basically I want to get rid of the "children" tag, that is normally required by the Layout class. I'm not sure how to set up the xml namespaces in JAXB either, so... help?


No comments:

Post a Comment