Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 16, 2008, 12:41 AM   #1
ace2600
macrumors member
 
Join Date: Mar 2008
Location: Austin, Texas
Using NSXMLNode, NSXMLElement, and NSXMLDocument?

I built my app for the device today and get errors around NSXMLNode, NSXMLElement, and NSXMLDocument. Those were recognized fine in the simulator. Any ideas?

Here is a post by someone else with a similar problem (but in the Mac Programming forum): http://forums.macrumors.com/showthread.php?t=506312
ace2600 is offline   0 Reply With Quote
Old Jul 16, 2008, 12:37 PM   #2
ace2600
Thread Starter
macrumors member
 
Join Date: Mar 2008
Location: Austin, Texas
So, these are not included in the final SDK. NSXMLDocument is considered too heavy.

This supposedly brings DOM support and XPath to XML in the iphone: http://code.google.com/p/touchcode/wiki/TouchXML.
ace2600 is offline   0 Reply With Quote
Old Jul 16, 2008, 12:55 PM   #3
phxbbrown
macrumors newbie
 
Join Date: Jun 2008
Location: Phoenix, AZ
TouchXML is pretty slick. I found it to be an adequate replacement for NSXMLDocument. It's read-only: there's no serialization behaviors defined. It uses libxml2, so it should be nice and quick.

Otherwise, the recent releases included NSXMLParser, which might work for you if you just need a forward-only XML reader. It uses callbacks to notify your app about parsing milestones as it goes through the document.

Bill
phxbbrown is offline   0 Reply With Quote
Old Jul 18, 2008, 02:31 PM   #4
fenrus110
macrumors regular
 
Join Date: Mar 2008
NSXMLParser seems like a pretty useless class to me.

All it seems to be is bunch of HARD CODED if-else statements of comparing the element names.

My app originally used NSXMLDocument to receive xml response data that I looped through to fill up some NSDictionary's so I could put them inside UITableView -> Detail view.

I pretty much need to loop through the entire xml data set, which has at least 50 elements. If I were to use NSXMLParser, would I be expected to write

if ([element name isEqualToString:@"firstname"] {
currentString = [NSMutableString string];
} else if ...

50 times for both "didStartEelement" and "didEndElement"? Sounds pretty ridiculous to me. Correct me if I'm wrong.
fenrus110 is offline   0 Reply With Quote
Old Jul 18, 2008, 09:10 PM   #5
DenNukem
macrumors member
 
Join Date: Jul 2008
Location: Seattle
You can use libxml2. That's what I do.
It's C only (not C++ or obj-c) so you have to manage memory carefully, but in return you get real DOM.
DenNukem is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
I removed my boot camp partition using disk utility and now I only can use 70gb? JJBro1 Windows, Linux & Others on the Mac 10 Dec 8, 2010 07:14 PM
Who is using my TC and using the most bandwidth? Davmeister Mac Basics and Help 2 Sep 20, 2009 01:31 PM
NSXMLElement and NSXMLNode CKriens Mac Programming 0 Jun 9, 2009 11:39 PM
Do you use Time Machine and What Drive do you use? scott9s Mac Peripherals 20 Mar 1, 2009 03:53 PM
Using XQuery on multiple NSXMLDocuments HiRez Mac Programming 0 Jul 31, 2008 10:38 PM


All times are GMT -5. The time now is 02:26 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC