DOMNode problems getting info out...
DOMNode problems getting info out...
- Subject: DOMNode problems getting info out...
- From: jon <email@hidden>
- Date: Sun, 23 Aug 2009 08:06:46 -0600
I have found that there is extremely limited documentation dealing
with DOMNodeLists and DOMNode...
for instance i found by pure accident that textContent works on a
node, and found no documentation on it... and lots references to
getAttribute or getElementID but can not get them to work...
so here is what i'm trying to do with code and maybe someone has
figured this out...
thanks in advance..
here is some data in some HTML that I would like to parse, i've
found how to get the text out, but i can't get this URL out....
<p> Aug 19 - <a href="http://whatever/sys/1331140637.html">Two 1GB
Apple matched pair RAM from a MacBook - $30 -</a><font size="-1">
(Louisville )</font></p>
here is the code i'm using to parse it.... most of it works,
including the textContent, last two lines don't work...trying to get
this "http://whatever/sys/1331140637.html" into a NSString, or NSURL
is failing me...
DOMDocument *myDOMDocument = [[myWebView mainFrame] DOMDocument];
DOMNodeList *allParas = [myDOMDocument getElementsByTagName:@"p"];
DOMNode *node = [allParas item:0];
NSString *top = [node textContent];
NSString *top2 = [node getAttribute:@"href"]; // this is way off,
just trying to find methods, but i expected getAttribute to atleast
be acknowledged as a method????
NSString *top4 = [node getElementById:@"href"]; // this is way
off, but i expected getElementById to atleast be acknowledged as a
method????
any help would be great...
thanks,
Jon.
_______________________________________________
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