• 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: How to get hyperlink in a html file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get hyperlink in a html file?


  • Subject: Re: How to get hyperlink in a html file?
  • From: John Stiles <email@hidden>
  • Date: Wed, 18 Oct 2006 09:30:11 -0700

I think the only way to do this and have it work with arbitrary web pages is to parse the DOM and look for links that way.
You can't cleanly scan for text given an arbitrary HTML file, since JavaScript is able to modify the DOM structure at will (or even document.write in a whole new section of the page!). Using JavaScript to construct a complicated page is not too uncommon.
I don't know if WebKit provides the tools to analyze the DOM from inside Obj-C. If not, you may have to use JavaScript :(


Mike Abdullah wrote:
Well you could use NSScanner to scan up to any instances of:

    <a

and then read in the URL from there. Not entirely sure it's the best method though.

Mike.

On 18 Oct 2006, at 04:57, Leo wrote:

Hi to all,

If this is a stupid question, I apologize in advance, though I am pretty
new at this Cocoa stuff.

I try to get the content of a html file, if some of the contents is like
this:

<tr>
<td>
<p><font face="Lucida Grande,Arial, sans-serif"><a
href="../pgs/557.html">About import settings and hard disk
space</a></font></p>
</td>
</tr>
<tr>
<td>
<p><font face="Lucida Grande,Arial, sans-serif"><a
href="../pgs/629.html">About AIFF and WAV custom import
options</a></font></p></td></tr>


how to search the hyperlink string? such as:

get the string "About import settings and hard disk space".

get the string "../pgs/557.html" and convert it to absolute path.

hope someone can help me. thanks.

Leo




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to get hyperlink in a html file?
      • From: Leo <email@hidden>
References: 
 >How to get hyperlink in a html file? (From: Leo <email@hidden>)
 >Re: How to get hyperlink in a html file? (From: Mike Abdullah <email@hidden>)

  • Prev by Date: How do I load a directory into a document-based app?
  • Next by Date: Re: Getting an NSOutlineView Item's parent
  • Previous by thread: Re: How to get hyperlink in a html file?
  • Next by thread: Re: How to get hyperlink in a html file?
  • Index(es):
    • Date
    • Thread