File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes converting java to xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "converting java to xml" Watch "converting java to xml" New topic
Author

converting java to xml

vaishali shah
Greenhorn

Joined: Sep 27, 2009
Posts: 4
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
Bartender

Joined: Oct 14, 2005
Posts: 18989
    
    8

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

Joined: Jul 26, 2007
Posts: 10535
    
    9

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


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: converting java to xml