• 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: Issue round-tripping XHTML through NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue round-tripping XHTML through NSTextView


  • Subject: Re: Issue round-tripping XHTML through NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Wed, 16 Nov 2005 12:30:39 -0800


On Nov 16, 2005, at 12:17 PM, Glen Simmons wrote:

I'm using an NSTextView to display and edit XHTML. The XHTML can contain links to files and the links can be relative or absolute. Thanks to help from the list, I know how to get relative links to work properly, using NSBaseURLDocumentOption, but when I translate back to XHTML, all the links are absolute. Is there a way to preserve relative vs. absolute?

One thought I had relating to this was to add a custom attribute to the element before creating the NSAttributedString. I hoped that custom attributes would be preserved through the round-trip, but alas, that doesn't seem to be the case. Should custom attributes be preserved or is there a way to get this to happen? If not, I'll file a bug.


Custom attributes are not expected to be preserved. NSAttributedString HTML handling should be considered as import and export, each of which may be lossy; there is no reason to expect round-trip fidelity. You could file an enhancement request, but given that elements in general are not preserved, it is not likely that custom attributes could be either.


A more likely request would be for a way to maintain relative links, but relative links are fragile, especially given that an NSAttributedString has no direct association with the base URL used to create it. Another possible request would be for more programmatic control over the generation of particular elements (A, in this case) when exporting HTML.

One possible workaround would be to use a custom scheme. If I remember correctly, you were already using a custom scheme; you might use one nonce scheme for absolute URLs, and another for relative URLs, then modify the resulting XHTML to get it into the final form you want.

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


References: 
 >Issue round-tripping XHTML through NSTextView (From: Glen Simmons <email@hidden>)

  • Prev by Date: Displaying image and core data
  • Next by Date: Re: Registration code
  • Previous by thread: Issue round-tripping XHTML through NSTextView
  • Next by thread: Displaying image and core data
  • Index(es):
    • Date
    • Thread