NSXML assistance please

2008-05-04 Thread Damien Cooke
I am porting a tool from Java to Cocoa.  I am reasonably new to XML  
and I am having some difficulties.


my Items in the XML look like this:



Item Name=01.Image.JPG PhysicalFilePath=C:\Documents and Settings 
\M01.Image.JPG Title=Bridge Category=Structures SubCategory=  
Region=South Australia MediaType=Photo

Keywords
  Keywordmulti-laned/Keyword
  Keywordnon-water-based/Keyword
/Keywords
  /Item

I can easily get the keywords out but have found no way of getting the  
attributes out of the Item tag.  Can someone make some suggestions?


Regards
Damien


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSXML assistance please

2008-05-04 Thread Chris Hanson

On May 4, 2008, at 3:53 PM, Damien Cooke wrote:

Item Name=01.Image.JPG PhysicalFilePath=C:\Documents and Settings 
\M01.Image.JPG Title=Bridge Category=Structures SubCategory=  
Region=South Australia MediaType=Photo

   Keywords
 Keywordmulti-laned/Keyword
 Keywordnon-water-based/Keyword
   /Keywords
 /Item

I can easily get the keywords out but have found no way of getting  
the attributes out of the Item tag.  Can someone make some  
suggestions?


If you're using NSXMLDocument to represent your XML, each Item is an  
NSXMLElement and you can therefore use NSXMLElement's attribute  
methods to get at its attributes.  Pretty basic, just read the docs on  
NSXMLElement:


http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSXMLElement_Class/Reference/Reference.html 



Also, if you're going to work with XML documents on Mac OS X, it's  
well worth reading the Tree-Based XML Programming Guide for Cocoa http://developer.apple.com/documentation/Cocoa/Conceptual/NSXML_Concepts/NSXML.html 
.


Read that document first and it'll give you a pretty good overview of  
what's available and where to look for figuring this sort of thing out.


  -- Chris

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]