Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 17, 2008, 11:06 PM   #1
DaveGee
macrumors 6502a
 
Join Date: Jul 2001
Workaround for missing NSXMLDocument?

Sad but true...

While NSXMLDocument works fine and dandy in the iPhone simulator Apple pulled the rug out from under us and DOES NOT include NSXMLDocument in the actual iPhone APIs (when compiling for the device)....

So in short anyone have any cleaver ways to work around this issue?

The stuff I need/rely on most are:

NSXMLDocument objectsForXQuery and NSXMLNode

The objectsForXQuery is a real necessity and I'm afraid any workaround will be a pain to develop...

Anyone got any ideas?

Thanks in advance!!

Dave
DaveGee is offline   0 Reply With Quote
Old Jul 17, 2008, 11:46 PM   #2
ayasin
macrumors 6502
 
Join Date: Jun 2008
I got bit by this today as well. Fortunately for my purposes manually dropping the stuff into a dictionary won't be too bad. That probably won't help you though...sorry.
__________________
iNeedStuff Shopping Assistant - MacLife called it "the ultimate iPhone grocery list maker".
Follow me on Twitter
Need a developer? PM me.
ayasin is offline   0 Reply With Quote
Old Jul 18, 2008, 08:16 AM   #3
DaveGee
Thread Starter
macrumors 6502a
 
Join Date: Jul 2001
Quote:
Originally Posted by ayasin View Post
I got bit by this today as well. Fortunately for my purposes manually dropping the stuff into a dictionary won't be too bad. That probably won't help you though...sorry.
Is there an easy way to do this?

I'm still somewhat green when it comes to Cocoa... the XML I get is quite basic really.... No deeply nested arrays of arrays of arrays or anything like that... its more like this:

Code:
<list>

<device>
<name code="143">thename</name>
<id>theid</id>
<statis>thestatus</status>
</device>

<device>
<name code="122">thename</name>
<id>theid</id>
<statis>thestatus</status>
</device>

<device>
<name code="153">thename</name>
<id>theid</id>
<statis>thestatus</status>
</device>

</list>
So it looks really simple but I don't wanna even think about trying to parse it with the limited string manipulation available in Cocoa.. OH WHAT I WOULD GIVE FOR REGEX!!! I could turn that XML into a tab delimited list of items with one simple REGEX call... but alas Apple doesn't believe it that either... Really odd if you ask me, I can't think of another programming environment that doesn't offer the developer quick and easy access to regex in some form or another...

If anyone has any idea -- even 'messy ones' I'm all ears... I *so* wanna get this app running on my iPod touch... Apple sure pulled a fast one on us by not including NSXML in the device (but allowing it in the simulator)...

Oh any before anyone asks if I can modify the 'source' that is providing me the XML.. that's a *no go* since its a hardware device running microcode that in turn does lots of stuff... one of which is providing SOAP access to people wanting to get data from it. (in short, a very close system).

Thanks

Dave
DaveGee is offline   0 Reply With Quote
Old Jul 20, 2008, 09:25 AM   #4
stadidas
macrumors regular
 
Join Date: Feb 2006
Location: Kent, United Kingdom
If you don't need to create any XML documents but just read them, then you can use NSXMLParser.
There is also this which has been created to mimic NSXML in terms of reading XML.
stadidas is offline   0 Reply With Quote
Old Jul 20, 2008, 01:01 PM   #5
DaveGee
Thread Starter
macrumors 6502a
 
Join Date: Jul 2001
Quote:
Originally Posted by stadidas View Post
If you don't need to create any XML documents but just read them, then you can use NSXMLParser.
There is also this which has been created to mimic NSXML in terms of reading XML.
Thanks and yea I found out that even tho just about all of NSXML was yanked Apple did leave us with NSXMLParser and quite frankly I took to it immediately (and I'm still in the 'advanced-beginner' stage of knowing Cocoa)... I even wrote my code in such a way that it handles 3 different XML sources so thats kinda nice... Yea it's probably not the *right way* to do things but it does the job quite nicely for me so I'm happy...

Dave
DaveGee is offline   0 Reply With Quote
Old Jan 14, 2009, 11:20 PM   #6
arashpayan
macrumors newbie
 
Join Date: Jan 2009
If you want a simplified NSXMLDocument replacement on iPhone, check out this little library I threw together for a project I recently finished:
http://arashpayan.com/projects/APXML

It doesn't handle all the fanciness of XML, but it allows you to load up XML documents into a DOM, and even create documents to write out to XML.

-Arash
arashpayan 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

Similar Threads
thread Thread Starter Forum Replies Last Post
32-bit workaround help JoLeSi Windows, Linux & Others on the Mac 7 Apr 8, 2014 06:52 PM
Resolved: UICollectionView and UIMenuController [workaround] ChristianJapan iPhone/iPad Programming 3 Sep 29, 2013 02:47 AM
Workaround for no remote/ir? brn2rnjk1 iMac 3 Dec 28, 2012 03:44 PM
Workaround for WD un-Bootable Drive? Jeferson MacBook Pro 1 Oct 26, 2012 10:40 PM
Verizon Workaround Imackintosh iPhone 1 Sep 13, 2012 09:26 PM

Forum Jump

All times are GMT -5. The time now is 07:46 PM.

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

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