No problem!
There are no hard and fast rules here. This was a quick and dirty approach
and I like to use tools rather than hand coding :-)
If you have a well-defined contract (XSD), just use xsd2java tool to
generate the bindings and you are good to go. Now that I see more closer,
your code should work fine as it is. You may want to add @XmlElement(name =
"string") to your getter LangReponseData.getSupportedLangs().
-Arul
On Tue, May 1, 2012 at 5:39 PM, Noah White <emailnbw_at_gmail.com> wrote:
> Arul,
>
> Thanks for the pointers/code! I took your advice about IDEA
> auto-generatation and took my XML response dropped it in a file and had
> IDEA generate an XSD then I had it generate the JAXB classes from that.
> Interesting they generated slightly different results then what you have
> here but they worked fine as well.
>
> I'm surprised the solution was as involved as it was, using
> @XMLRegistry/ObjectFactory etc. I would have thought two simple POJOs with
> basic JAXB annotations would have done the trick. For example I have
> another case where the response I parse looks like this:
>
> <string xmlns="http://schemas.micrsoft.com/2003/10/Serialization/"">blah
> blah blah</string>
>
> For that I was able to simply use:
>
> @XmlRootElement(name = "string", namespace="
> http://schemas.micrsoft.com/2003/10/Serialization/")
> public class StringResponseData {
>
> private String _string;
>
> @XmlValue
> public String getString() {
> return _string;
> }
>
> pubic void setString(String aString) {
> _string = aString;
> }
>
> public StringResponseData() {}
>
> }
>
> Which is why I thought I could simply nest this in a wrapper class for
> ArrayOfstring to take care of the other case.
>
> Anyhow, much appreciated! Thanks,
>
> -Noah
>
>
--
http://aruld.info
http://twitter.com/aruld