1

Is it possible to generate a static hashmap using an XML schema with JAXB. If yes, then please specify what that schema will look like.

Ashish
  • 3,028
  • 5
  • 28
  • 35
  • Are you trying to write XML which will unmarshal into a hashmap? If so, what are the types in your hashmap? Is it String to String? Or something else? (Or have I misunderstood the question entirely?) – Erica Dec 13 '11 at 06:16
  • yes, I need to write an XML which would unmarshal to a static hashmap in the generated class. It would be Map and it will be contained in MyClass itself. My main objective is to create objects of MyClass and put them in the static Hashmap in the same class mapping to their name – Ashish Dec 13 '11 at 06:48
  • Is the static `HashMap` required for reasons other than sorting out object relationships (based on your related question: http://stackoverflow.com/questions/8358791/how-to-create-java-objects-from-xml-tags-which-are-referring-each-other). If so the following strategy may work better for you: http://stackoverflow.com/questions/5319024/using-jaxb-to-cross-reference-xmlids-from-two-xml-files/5327425#5327425 – bdoughan Dec 13 '11 at 21:07

0 Answers0