aspose file tools*
The moose likes Beginning Java and the fly likes convert Vector to xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert Vector to xml" Watch "convert Vector to xml" New topic
Author

convert Vector to xml

peter brews
Ranch Hand

Joined: Jan 25, 2002
Posts: 59
Input will be vector whose each element will itself be a vector.Length of vector of each element may vary for different calls.Only the selected element needs to be placed in proper order in the output.For ex. field2 is not required in the output.Also field4 is placed before field3.Below is the code that I tried to write.Can any one help me with better solution.

The Input is vector :
"[ [field1,f1_val1,f1_val2,f1_val3,f1_val4] ,[field2,f2_val1,f2_val2,f2_val3,f2_val4],
,[field3,f3_val1,f3_val2,f3_val3,f3_val4,f3_val5],
,[field4,f4_val1,f4_val2]] )

Expected output is :
< FIELD Row=1>
<field1>f1_val</field1>
<field4>f2_val1</filed4>
<field3>f3_val1</field3>
</FIELD>
< FIELD Row=2>
<field1>f1_va2</field1>
<field4>f2_val2</filed4>
<field3>f3_val2</field3>
</FIELD>
< FIELD Row=3>
<field1>f1_va3</field1>
<field3>f3_val3</field3>
</FIELD>
< FIELD Row=4>
<field1>f1_val4</field1>
<field3>f3_val4</field3>
</FIELD>
< FIELD Row=5>
<field3>f3_val5</field3>
</FIELD>
Code:

edited by Dave to put the code in the UBB code tags.
[ February 27, 2002: Message edited by: Dave Vick ]
[ February 27, 2002: Message edited by: smita agarnal ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convert Vector to xml