Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 5, 2012, 11: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, 04: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, 05: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

Similar Threads
thread Thread Starter Forum Replies Last Post
Formatting text file in AppleScript dam316 Mac Programming 1 May 5, 2014 11:21 AM
changing NSTextView string value abcdefg12345 Mac Programming 4 Feb 5, 2014 07:50 AM
vBulletin text formatting BB code error. Anonymous Freak Site and Forum Feedback 1 Dec 20, 2013 12:22 PM
Edit Specific Text In NSTextView jpeezy Mac Programming 0 Mar 20, 2013 11:16 AM

Forum Jump

All times are GMT -5. The time now is 05:36 PM.

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

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