XSXMLNode nodesForXPath bug?
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