M
Mary Smith
I want to create a new XML file from another XML file. The original file will be stored on the hard drive and it is about 3mb. I do not need everything from the original XML file so the new one will be much smaller and easier to manage. I only need to do this when new data has been added to the original XML file. Here is a sample of what I have.
Original XML file
<movielist>
<movie>
<index>1</index>
<title>Casino Royale</title>
<cast>
<star>
<person>
<displayname>Daniel Craig</displayname>
</person>
<character>James Bond</character>
</star>
<star>
<person>
<displayname>Eva Green</displayname>
</person>
<character>Vesper Lynd</character>
</star>
</cast>
</movie>
<movie>
<index>2</index>
<title>Spider-Man</title>
<cast>
<star>
<person>
<displayname>Tobey Maguire</displayname>
</person>
<character>Spider-Man/Peter Parker</character>
</star>
<star>
<person>
<displayname>Kirsten Dunst</displayname>
</person>
<character>Mary Jane Watson</character>
</star>
<star>
<person>
<displayname>Willem Dafoe</displayname>
</person>
<character>Green Goblin/Norman Osborn</character>
</star>
</cast>
</movie>
</movielist>
Below is how I want the new file to look by combining the displayname and character in the cast section.
New XML file
<movielist>
<movie>
<index>1</index>
<title>Casino Royale</title>
<cast1>Daniel Craig - James Bond</cast1>
<cast2>Eva Green - Vesper Lynd</cast2>
</movie>
<movie>
<index>2</index>
<title>Spider-Man</title>
<cast1>Tobey Maguire - Spider-Man/Peter Parker</cast1>
<cast2>Kirsten Dunst - Mary Jane Watson</cast2>
<cast3>Willem Dafoe - Green Goblin/Norman Osborn</cast3>
</movie>
</movielist>
Any help will be greatly appreciated
Thanks
Mary
Original XML file
<movielist>
<movie>
<index>1</index>
<title>Casino Royale</title>
<cast>
<star>
<person>
<displayname>Daniel Craig</displayname>
</person>
<character>James Bond</character>
</star>
<star>
<person>
<displayname>Eva Green</displayname>
</person>
<character>Vesper Lynd</character>
</star>
</cast>
</movie>
<movie>
<index>2</index>
<title>Spider-Man</title>
<cast>
<star>
<person>
<displayname>Tobey Maguire</displayname>
</person>
<character>Spider-Man/Peter Parker</character>
</star>
<star>
<person>
<displayname>Kirsten Dunst</displayname>
</person>
<character>Mary Jane Watson</character>
</star>
<star>
<person>
<displayname>Willem Dafoe</displayname>
</person>
<character>Green Goblin/Norman Osborn</character>
</star>
</cast>
</movie>
</movielist>
Below is how I want the new file to look by combining the displayname and character in the cast section.
New XML file
<movielist>
<movie>
<index>1</index>
<title>Casino Royale</title>
<cast1>Daniel Craig - James Bond</cast1>
<cast2>Eva Green - Vesper Lynd</cast2>
</movie>
<movie>
<index>2</index>
<title>Spider-Man</title>
<cast1>Tobey Maguire - Spider-Man/Peter Parker</cast1>
<cast2>Kirsten Dunst - Mary Jane Watson</cast2>
<cast3>Willem Dafoe - Green Goblin/Norman Osborn</cast3>
</movie>
</movielist>
Any help will be greatly appreciated
Thanks
Mary