Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. <ProtocolloList>
  2. <protocollo>
  3. <numero>1</numero>
  4. <data>2014-06-23</data>
  5. <oggetto/>
  6. <destinatario/>
  7. <operatore/>
  8. </protocollo>
  9. ...
  10. </ProtocolloList>
  11.  
  12. import javax.xml.bind.annotation.XmlElement;
  13. import javax.xml.bind.annotation.XmlRootElement;
  14.  
  15. @XmlRootElement(name = "protocollo")
  16. public class Protocollo {
  17.  
  18. private int numero;
  19. private String data;
  20. private String oggetto;
  21. private String destinatario;
  22. private String operatore;
  23.  
  24. public Protocollo(String d, String o, String des, String op) {
  25. this.data = d;
  26. this.oggetto = o;
  27. this.destinatario = des;
  28. this.operatore = op;
  29. }
  30.  
  31. public Protocollo() {
  32.  
  33. }
  34.  
  35. @XmlElement
  36. public int getNumero() {
  37. return numero;
  38. }
  39.  
  40. public void setNumero(int numero) {
  41. this.numero = numero;
  42. }
  43.  
  44. @XmlElement
  45. public String getData() {
  46. return data;
  47. }
  48.  
  49. public void setData(String data) {
  50. this.data = data;
  51. }
  52.  
  53. @XmlElement
  54. public String getOggetto() {
  55. return oggetto;
  56. }
  57.  
  58. public void setOggetto(String oggetto) {
  59. this.oggetto = oggetto;
  60. }
  61.  
  62. @XmlElement
  63. public String getDestinatario() {
  64. return destinatario;
  65. }
  66.  
  67. public void setDestinatario(String destinatario) {
  68. this.destinatario = destinatario;
  69. }
  70.  
  71. @XmlElement
  72. public String getOperatore() {
  73. return operatore;
  74. }
  75.  
  76. public void setOperatore(String operatore) {
  77. this.operatore = operatore;
  78. }
  79.  
  80. }
  81.  
  82. import java.util.ArrayList;
  83.  
  84. import javax.xml.bind.annotation.XmlElement;
  85. import javax.xml.bind.annotation.XmlElementWrapper;
  86. import javax.xml.bind.annotation.XmlRootElement;
  87.  
  88. @XmlRootElement(name = "ProtocolloList")
  89. public class ProtocolloList {
  90.  
  91. @XmlElementWrapper(name = "ProtocolloList")
  92. @XmlElement(name = "protocollo")
  93. private ArrayList<Protocollo> ProtocolloList;
  94.  
  95. public ArrayList<Protocollo> getProtocolloList() {
  96. return ProtocolloList;
  97. }
  98.  
  99. public void setProtocolloList(ArrayList<Protocollo> protocolloList) {
  100. ProtocolloList = protocolloList;
  101. }
  102. }
  103.  
  104. JAXBContext jaxbContext = JAXBContext.newInstance(Protocollo.class);
  105. Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
  106. StringReader reader = new StringReader(this.resultXML);
  107. protocolli = (ProtocolloList) unmarshaller.unmarshal(reader);
  108.  
  109. unexpected element (uri:"", local:"ProtocolloList"). Expected elements are <{}protocollo>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement