• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding child nodes to xml reccursively using java  RSS feed

 
Soumik Barori
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



I am having input XML as below:







And a Map containing the key as id of each department. Eg:



Key = "1"

Value =





Key = "4"



Value =





Key = "6"

Value =




Key = "7"

Value =





And so on



i.e. a List containing all the department id and corresponding sub departments



Expected Response is:




Below is the java code used:





Can someone please help me and let me know where I'm going wrong, I want the function to return a departments with all the sub department information
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

I'm sorry but I don't understand how you get from the input you showed to your expected output. Can you explain in more detail what you are trying to achieve and what the transformation rules are.
Also why does the 'childs' attribute have a mix of 'yes', 'no' and 'true', 'false' values?

BTW filling your post with lots of blank lines makes to hard to read on a small screen (laptop, notebook etc) as I have to continually scroll up and down to read the post. The harder it is for people to read your posts the less chance you have of getting an answer so I would advise you only use 1 blank line between sections.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!