Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 5, 2012, 10:27 AM   #1
dryjoy
macrumors regular
 
Join Date: Mar 2009
Help with text formatting in an NSTextView

I'm pretty inexperienced with Objective-C & Cocoa, but learning fast! I'm working on an app that needs to parse XML files, and format some text according to a few pseudo-HTML tags, such as <body>content</body> and <heading>content</heading> etc.

I've been doing some command-line app experiments with the NSXML API (NSXMLNode, NSXMLDocument, NSXMLElement etc.) and I'm happy about reading, writing, creating, parsing etc. an XML document.

What I'm not sure of is, once I've extracted the data from the XML document and got a tree of XML objects, how to format the text in the NSTextView, and also how to detect which ranges of text in the NSTextView are in what size, font weight etc.

Could somebody please point me towards the appropriate classes etc, and I'll try and work it out from the Apple docs.
dryjoy is offline   0 Reply With Quote
Old Jan 5, 2012, 03:20 PM   #2
jiminaus
macrumors 65816
 
Join Date: Dec 2010
Location: Sydney
These guides should get you started:
Text System Overview
Cocoa Text Architecture Guide
Text System User Interface Layer Programming Guide
Text Attributes
Attributed String Programming Guide
Text Layout Programming Guide

Or you could possibly transform your XML into HTML, display it in a WebView, and implement the editing behaviour with a combination of JavaScript, web script objects and a WebEditingDelegate.
jiminaus is offline   0 Reply With Quote
Old Jan 5, 2012, 04:14 PM   #3
dryjoy
Thread Starter
macrumors regular
 
Join Date: Mar 2009
Thanks very much. I'll have a read... no doubt I'll have some specific questions once I get stuck in.
dryjoy is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Help with port forwarding for Security software? PPFee Mac Applications and Mac App Store 1 Dec 11, 2011 03:34 PM
help with text boxes in Pages TonyBaloney Mac Applications and Mac App Store 2 Dec 9, 2011 04:19 PM
Issue with rich text formatting in Mail.app Ekim Neems Mac Applications and Mac App Store 0 Jul 26, 2011 08:48 AM
Help with conditional formatting in Numbers jakeene Mac Applications and Mac App Store 0 May 4, 2010 02:33 PM
[solved] Help with CSS Formatting - text above image bug Consultant Web Design and Development 4 Feb 6, 2010 05:44 PM


All times are GMT -5. The time now is 03:31 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC