• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

converting java to xml

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic