CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2009
    Posts
    2

    converting a file in XML

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

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: converting a file in XML

    Quote Originally Posted by sky123
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured