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 Nested Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Nested Map" Watch "Nested Map" New topic
Author

Nested Map

Amar GURU
Greenhorn

Joined: Apr 02, 2003
Posts: 5
Hi ,
I want to create one XML from the MAP[contains DATA]. Datas are stored in Map inside MAP inside MAP[ Nested MAPS].
Is it possible to write a generic method which just parses thru MAP and creates the XML.
EX:
INPUT MAP
RootMap -- 2 elements
1. Child1Map
2. Child2Map
Child1Map -- has two string elements [for creating Node]
Child2Map -- has two string elements [For creating Node]

OUTPUT XML
<Root>
<child1>blah..<child1>
<child11>blah..<child11>
<child12>blah..<child12>
<child2>blah..<child2>
<child21>blah..<child21>
<child22>blah..<child22>
</Root>

Please anyone give me idea or code How to do this..
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Greetings Amar,
Welcome to JavaRanch, the absolute best site on the www for Java information. We don't have many rules around here, but we do have one. Please change your display name to a real first and last name to conform with the JavaRanch Naming Policy.
You can change it here: Change your display name.


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Well, it boils down to two nested entrySet() iterations over the Map.Entry's, doesn't it? Can you tell us what you have tried so far and where you got stuck?
- Peter
Amar GURU
Greenhorn

Joined: Apr 02, 2003
Posts: 5
Thanx..
I tried it and I got the Solutions.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Second warning Amar. If you don't change your display name to conform to the JavaRanch naming policy, I'll have a Sheriff close your account.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I am sorry - but don't the REST of you find that topic title WAAAAAAY to hard to resist . . .


"JavaRanch, where the deer and the Certified play" - David O'Meara
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
How do you think I ended up in this thread in the first place I hope my disappointment didn't show too much
- Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Nested Map