Introduction
Used to specify that the associated member is to be marshalled to and from an xml element of the root object node
Details
Used like this for variables
[XmlElement(name="level")]
public var level:int;
or this for getters and setters
private var _level;
[XmlElement(name="level")]
public function get level():int
{
return _level;
}
public function set level(value:int):void
{
_level = value;
}- The name of the element in the XML and the name of the variable do not need to match
- For unmarshalling you MUST provide a public setter
when the variable is null, then we mashal the object,we will get the xml with the null value of the attribute . We are not expected to see null value in the xml.Therefore,is there any solution for us to realise that?
Yes - I will build in a check to make sure that null elements do not get output in the XML - expect a new version soon
How would I define an element that also has an attribute as well as contents? For example:
<property key="id"> 123 </property>
JAXB does support this using @XmlValue?, but it's not clear to me how to define it using this library. BTW, is this project still active?