• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

converting java to xml

 
vaishali shah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
I have a list of object and using xstream i was able to convert the arraylist to xml. the resultant xml is as follows


But what i wanted was something like this.. <root><displayName "xyx" isBranch= true><displayName "abc" isBranch= false></displayName></displayName><displayName "efg" isBranch= false></displayName></root>.. I will probably have to make tags for this manually by iterating through the java list. i will need a recursive method for this probably the moment the list is created. Could some one help me with the recursive method so that the xml is generated as above coz i need to bind this to flex on the screen which requires the mentioned root format.


My java list creation is as follows



 
Paul Clapham
Sheriff
Pie
Posts: 20729
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually if you have one XML format and you want to systematically transform it to a different XML format, you will find that XSLT is a good way to do that.
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vaishali,
Welcome to the Ranch.

In future, while posting code, please UseCodeTags
I have edited your existing post. As you can see it is now much more easier to read and understand.
Also, please do check out http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic