Click to See Complete Forum and Search --> : converting a file in XML


sky123
April 4th, 2009, 08:50 AM
hi..I have a file like this

Video //Video1
Start
Name =
Director =

Actor
Start
Name =
Rating =
End
Actor
Start
Name =
Rating =
End

END //End of Video

Video //Video2
Start
//..as above. number of actors may vary
End

and I have to convert above file into a XML in following format..

<Videos> //Root
<Video> // Video1
<Property>
<NAME Name = X>
<DIRECTOR Name = abc >
</Property>
<Details>
<Actor>
<Property>
<NAME Name = N1>
<RATING rating = >
</Property>
</Actor>
<Actor>
<Property>
<NAME Name = N2>
<RATING rating = >
</Property>
</Actor>
</Details>
</Video> //End of Video1
<Video> //Video2
..same as above
<Video>
</Videos>

Can you please suggest me what is the best way to do this. My solution is working when the

text file has only one Video..for multiple Video its not working properly..it will be better

if you provide code..(a file may have multiple Video and number of Actor in a Video may vary)
Thanks..

nelo
April 4th, 2009, 06:03 PM
Can you please suggest me what is the best way to do this. My solution is working when the

text file has only one Video..for multiple Video its not working properly..it will be better

if you provide code..(a file may have multiple Video and number of Actor in a Video may vary)
Thanks..
Why don't you provide the solution you've got? Then anybody would be able to show how you can improve it to do what you want it to do.