Quote:
Originally Posted by locodavid64
i have this xml
<video>
<name>TRAILER</name>
<description>Main Description</description>
<type>video clip</type>
<releasetype>New Release</releasetype>
<thumbnail>/managed.png</thumbnail>
<title>
<name>THE CONCERT EXPERIENCE</name>
<fullName>The Concert Experience</fullName>
<shortName>The Concert Experience</shortName>
<official_site_url>http://movierewards/</official_site_url>
<buy_links>
<buy_link>
<format>DVD</format>
<seller>Store</seller>
<url>http://view.atdmt.com/action/Concert_DVD_buynow</url>
</buy_link>
<buy_link>
<format>BD</format>
<seller>tore</seller>
<url>http://view.atdmt.com/action/BR_buynow</url>
</buy_link>
<category>VH1</category>
</categories>
</title>
</video>
How can i parse only the element <name> inside <title> element and not <name> that contains "TRAILER" ?
Thanks in advance
|
Have a bool called inTitle and set it to false initially. As you're parsing the file, when you find an element called title, set inTitle to true, and when title ends set inTitle to false. When you check for the name element, also check if inTitle is true, if it is then you have the right name, if its not then you have the wrong name.