New to using XML with Cocoa

Discussion in 'Mac Programming' started by DaveP, Sep 13, 2005.

  1. DaveP macrumors 6502

    DaveP

    Joined:
    Mar 18, 2005
    #1
    Hey Everybody,
    I would consider myself a pretty competent programmer, but I have little to none web-type experience, including XML. For my Cocoa project I want to be able to output and intput values to and from a file respectively, using XML. When I don't know how to do something it's usually just a case of reading a web page or two to figure it out. But there is information overload regarding XML, and most of the information is not very useful.

    So a few questions...First off I quickly discovered there are a few ways in Cocoa to handle XML, the most current seems to be the NSXML classes (correct me if I'm wrong). Is this the way to go? Secondly, are there any good sites that will help me out. And finally, feel free to make any other suggestions that might help.

    Thanks,
    Dave
     
  2. stoid macrumors 601

    stoid

    Joined:
    Feb 17, 2002
    Location:
    So long, and thanks for all the fish!
    #2
    I started a class this fall learning XML/CSS/XSL/DTD/etc. and our main textbook is the XML Bible 1.1, 3rd Edition by Elliotte Harold. I have found it to be an excellent introduction to XML related technologies. Too bad I can't find a good XML/XSL/DTD manipulator for the Mac.
     
  3. GeeYouEye macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #3
    Yes, just use NSXMLParser for reading. A bit of a learning curve, but very useful. For writing, I haven't done anything with XML in Tiger, but as of Panther, I think you needed to create the string/data to write out to the file using -writeToFile:.

    BTW, I've heard that PyObjC is much, much better for XML work than straight Cocoa. YMMV, of course.
     
  4. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    If you're planning on using your app only for Tiger, then use NSXML, but if you need compatibility with 10.3 or 10.2, you need to use something else, like this: http://iharder.sourceforge.net/macosx/xmltree/ which works great.
     
  5. DaveP thread starter macrumors 6502

    DaveP

    Joined:
    Mar 18, 2005
    #5
    Does this work with Tiger? The download app says for Jaguar only and I cannot build and run on my system (which has Tiger). Hopefully it does because I'm looking for somethign that will work with 10.4 and 10.3.

    Thanks
     
  6. kainjow Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000

Share This Page