Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-13-2009, 10:49 PM   #1 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 2
locodavid64 is on a distinguished road
Default XML PARSING ISSUE

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
locodavid64 is offline   Reply With Quote
Old 07-14-2009, 12:33 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Fort Lauderdale, Florida
Posts: 67
Ins3rtNam3H3r3 is an unknown quantity at this point
Default

Quote:
Originally Posted by locodavid64 View Post
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.
Ins3rtNam3H3r3 is offline   Reply With Quote
Old 07-14-2009, 07:58 AM   #3 (permalink)
New Member
 
Join Date: Jul 2009
Posts: 2
locodavid64 is on a distinguished road
Default

Thanks for the help... but i am looking for a better solution for this.
locodavid64 is offline   Reply With Quote
Old 07-14-2009, 08:27 AM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

a better solution would be to change the XML so you dont have to deal with this issue. Rename one of the "name" tags to something else.
smithdale87 is offline   Reply With Quote
Old 07-14-2009, 08:36 AM   #5 (permalink)
Registered Member
 
MikesTooLz's Avatar
 
Join Date: Jan 2009
Location: Miami, Florida
Posts: 211
MikesTooLz is on a distinguished road
Send a message via AIM to MikesTooLz
Default

never mind
MikesTooLz is offline   Reply With Quote
Old 07-14-2009, 09:32 AM   #6 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 43
specialk is on a distinguished road
Default

Look at NSXml for the Cocoa specific way of processing XML
specialk is offline   Reply With Quote
Reply

Bookmarks

Tags
nsxmlparser, parse, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 317
9 members and 308 guests
chiataytuday, coolman, givensur, ipodphone, jbro, mottdog, mtl_tech_guy, Punkjumper, vilisei
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,882
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:18 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0