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..
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..