• 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
XSXMLNode nodesForXPath bug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

XSXMLNode nodesForXPath bug?


  • Subject: XSXMLNode nodesForXPath bug?
  • From: "Stephen Deken" <email@hidden>
  • Date: Fri, 8 Jun 2007 15:04:16 -0500

Hello list,

Is the following a bug in Cocoa's XPath implementation, a problem with
the XML I'm running it against, or am I just criminally stupid?

I'm dealing with a dump of the Penny Arcade's forum page:

    http://forums.penny-arcade.com/

The output appears to be valid XHTML; it loads into an NSXMLDocument
with no warnings.  I can then execute some XPath queries on it:

    //a[starts-with(@href,'forumdisplay')]

This gives me all of the anchor elements that point to
forumdisplay.php.  Now I want to get all of the text descendants, so
I'd write:

    //a[starts-with(@href,'forumdisplay')]
     /descendant::text()

But this returns all manner of crap that's unrelated to what I want
and completely outside the anchors I'm interested in.  If I add a
technically useless constraint:

    //a[starts-with(@href,'forumdisplay')]
     /descendant::text[ancestor::a[starts-with(@href,'forumdisplay')]]

...then I get back what I'm looking for, even though the ancestor
constraint should be completely useless.  Should I really have to note
that I only want the descendants who have me as an ancestor?

Can anyone here give me some insight on this?

--
Stephen Deken
email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: XSXMLNode nodesForXPath bug?
      • From: Tomas FranzĂ©n <email@hidden>
  • Prev by Date: Re: Core Data app becomes a memory hog
  • Next by Date: CoreData and image caching
  • Previous by thread: Re: How can I make an NSScrollView scroll to the top?
  • Next by thread: Re: XSXMLNode nodesForXPath bug?
  • Index(es):
    • Date
    • Thread