java - Use JAXB to create Object from XML String -


How can I use the code given below to add a map to an XML string below the JAXB object?

  JXBCTXXNTEX = JXBCTXEIEIIIntension (PersonClass); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller (); Person person = (person) unmarshaller.unmarshal ("XML string here"); @ XmlErment (name = "First-Name") string first name; @ XmlElement (name = "Last-Name") string lastName; Public string getFirstName () {return firstName; } Public Zero SetFirst-name (string first name) {this.firstName = firstName; } Public string getLastName () {lastName; } Public Zero setLlastName (string last name) {this.lastName = lastName; }}    

To pass XML content, you will get a reader , and instead Anupam:

  JXBNTXXXXTP = JXABTXX Newestience (PersonClass); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller (); StringReader Reader = New Stringer ("XML String Here"); Person person = (person) unmarshaller.unmarshal (reader);    

Comments