Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <foo value1="a" value2="b">value3</foo>
  2.  
  3. @XmlType(propOrder = {"value3"}, name = "foo")
  4. @XmlAccessorType(XmlAccessType.FIELD)
  5. public class Foo
  6. {
  7. @XmlAttribute
  8. private String value1;
  9.  
  10. @XmlAttribute
  11. private String value2;
  12.  
  13. @XmlElement(name = "")
  14. private String value3;
  15. }
  16.  
  17. @XmlAccessorType(XmlAccessType.FIELD)
  18. public class Foo
  19. {
  20. @XmlAttribute
  21. private String value1;
  22.  
  23. @XmlAttribute
  24. private String value2;
  25.  
  26. @XmlValue
  27. private String value3;
  28. }
  29.  
  30. If a class has @XmlElement property, it cannot have @XmlValue property
  31.  
  32. @XmlRootElement(name="priceInclVat")
  33. @XmlAccessorType(XmlAccessType.FIELD)
  34. public class PriceInclVatInfo {
  35.  
  36. @XmlAttribute
  37. private String currency;
  38. @XmlValue
  39. private String currencyCode;
  40.  
  41. }
  42.  
  43. <currencyCode plaintext="£">GBP</currencyCode>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement