• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing attributes of XML
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing attributes of XML


  • Subject: Re: Accessing attributes of XML
  • From: "Christian Graus" <email@hidden>
  • Date: Tue, 6 May 2008 07:30:08 +1000

On Tue, May 6, 2008 at 2:28 AM, Jens Alfke <email@hidden> wrote:

>
> On 5 May '08, at 5:34 AM, Christian Graus wrote:
>
>  NSXMLElement *node2  = [array objectAtIndex:nodeCount];
> >
> > NSXMLElement *name = [node2 attributeForName:@"Name"];
> >
>
> 'name' should be declared as NSXMLNode*, or you'll get a compiler
> type-mismatch warning. (But that doesn't explain why its -stringValue would
> be nil.) Try setting a breakpoint after this line in the debugger, then in
> the debug console enter "po name" and it should print the XML corresponding
> to that node*.
>


Thank you for the hint on using po.  I am very new to all things Mac (
although, I was there when the first Mac was shown in Melbourne, way before
I ever saw a PC.... ), and I am still working out how the debugger in XCode
works.  As for NSMXLNode, I moved to NSXMLElement to get access to
attributeForName, I was using NSXMLNode before that, still to no avail.



>
>
>  I cannot work out how to access the inner Text of the node
> >
>
> [node2 stringValue]. (NSXMLElement inherits that from NSXMLNode.)
>


OK - I was trying that and got nothing back.  As in, the debugger seemed to
be telling me the value was null.


>
>
>  The attributes collection should be 15 odd objects, and it's 0.
> >
>
> Hm, I don't see why that wouldn't work. Again, at your breakpoint type "po
> node2" and see what XML it contains; you might not have gotten the element
> you expected.
>


Thanks - hopefully this is going to really help me work out what is going
wrong here, although I suspect we're going to move to the DOM implimentation
I found in the docs last night.  Using a standard interface would really
help me, especially as there doesn't seem to be any intellisense in XCode.

Thanks for your help, it's much appreciated.


Christian
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Accessing attributes of XML
      • From: Jens Alfke <email@hidden>
References: 
 >Accessing attributes of XML (From: "Christian Graus" <email@hidden>)
 >Re: Accessing attributes of XML (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: -draggingEntered: never gets called
  • Next by Date: What do these errors mean?
  • Previous by thread: Re: Accessing attributes of XML
  • Next by thread: Re: Accessing attributes of XML
  • Index(es):
    • Date
    • Thread