1) I would expect the "name" and "EngineSize" elements to be prefixed with "p:" similar to Cartype as all the elements
are defined in the same targetname space.
Why is this not the case ?
2) I am not able to unmarshall the above xml as shown, but if I prefix the "name" and EngineSize elements with "p:",
I am than able to unmarshall the xml.
Is it possible to unmarshall the xml without making this change ?
3) How is the prefix "p" derived ?
Can this be specified.
Would you be able to elaborate a bit more as I am not clear on this.
You can use schema compiler to generate a typical setup of the object graph.
Checked this and it is as you have said.
In particular, you may be interested to note that the schema binding for the elementFormDefault being qualified is reflected in the package-info.java. And that the local scope elements are generated as inner classes rather than classes sitting in the package directory as such.
The point is also that you may be able to parse the setup of pojo you're actually running with (that we don't have any idea what it is, but I may devine somehow what it probably looks like), but that you won't be able to validate with the schema "as such" with out addition I mentioned
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED.