Re: ebook reader suggestions
Re: ebook reader suggestions
- Subject: Re: ebook reader suggestions
- From: Gary Yuen <email@hidden>
- Date: Fri, 1 Jul 2005 09:57:09 +0800
Hi Douglas,
Thanks for the suggestions. For now, I kind of have it hacked a bit.
My XHTML document has a JavaScript function that hides or shows class
IDs. I call the function and tell it what to show. It sounds like DOM
would be a better way?
Sometime later I'll figure out how to do parallel text. If there's
two XHTML documents should I use two webviews? Each document has the
same contents: the same chapter, the same number of sections, or
paragraphs. The paragraph lengths are different though and I'd like
to have them next to each other.
Gary
Le 2005/7/1 à 上午 8:21, Douglas Davidson a écrit :
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
-----
As soon as you feel yourself against me you have ceased to understand
my position and consequiently my arguments! You have to be the victim
of the same passion! - Nietzsche
_______________________________________________
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