Re: ebook reader suggestions
Re: ebook reader suggestions
- Subject: Re: ebook reader suggestions
- From: Douglas Davidson <email@hidden>
- Date: Thu, 30 Jun 2005 17:21:53 -0700
On Jun 29, 2005, at 7:51 PM, Gary Yuen wrote:
If I have XHTML documents that let's say contained a whole chapter
or even book, how would I go about displaying only chapters or
sections? DOM? Can I get use DOM to selectively display only parts
of XHTML? Any good docs to get started with this?
You can use the DOM APIs to extract a portion of a document--a range,
say--and insert it into another document. So, for example, you could
use one (not displayed) WebView to load and parse your document into
a DOM, and then extract a portion of it and insert it into another
(displayed) WebView to show an individual section of the document.
An alternative approach would be to convert the document to an
attributed string, using the text system's ability to import HTML.
This is not completely faithful, since attributed strings cannot
represent all of the features of HTML, but it may be sufficient for
your purposes, and extracting substrings from attributed strings is
more straightforward and less problematic than similar operations on
a DOM.
Douglas Davidson
_______________________________________________
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