Reading custom rtf attributes

  • Looking for hooks into some Cocoa class where I can get custom
    attributes from an rtf file as it's being read in.
    My goal is to be able to get the data from a rtf/cre (rtf file with
    court reporter extensions) file without writing my own parser.

    I can read a rtf file into a NSText object but it ignores the
    attributes it doesn't understand. In the case of these files they are
    composed of around 30,000 attributes that are not understood and no
    other text.

    What I'm hoping for is some hook where I can get a hold of the ignored
    attributes as the file is being read. I don't really care what kind of
    object is doing the reading; it's all about the side effect. On the
    other hand, if there is an interface to apples rtf parser (I've never
    seen anything like this) that would be very cool.

    I see a lot of posts from people on this list about creating custom
    attributes but nothing on reading existing ones. I saw one reference
    to using NSLayoutManager but I'm not seeing how that would work.

    BYW, If you really need to know why I want to do this see: http://captioning.robson.org/resources/rtfcre/
    .

    Any ideas, comments or references are appreciated,
    Paul
  • Exciting ideas.

    Since you most likely will not find any way to "patch" the parser with
    Cocoa, check-out the Microsoft sample code for RTF parsing.

    http://msdn.microsoft.com/library/en-us/dnrtfspec/html/rtfspec_53.asp

    2006/10/2, Paul FitzGerald <paf...>:
    > Looking for hooks into some Cocoa class where I can get custom
    > attributes from an rtf file as it's being read in.
    > My goal is to be able to get the data from a rtf/cre (rtf file with
    > court reporter extensions) file without writing my own parser.
    >
    > I can read a rtf file into a NSText object but it ignores the
    > attributes it doesn't understand. In the case of these files they are
    > composed of around 30,000 attributes that are not understood and no
    > other text.
    >
    > What I'm hoping for is some hook where I can get a hold of the ignored
    > attributes as the file is being read. I don't really care what kind of
    > object is doing the reading; it's all about the side effect. On the
    > other hand, if there is an interface to apples rtf parser (I've never
    > seen anything like this) that would be very cool.
    >
    > I see a lot of posts from people on this list about creating custom
    > attributes but nothing on reading existing ones. I saw one reference
    > to using NSLayoutManager but I'm not seeing how that would work.
  • On Oct 1, 2006, at 8:34 PM, Paul FitzGerald wrote:

    > What I'm hoping for is some hook where I can get a hold of the
    > ignored attributes as the file is being read. I don't really care
    > what kind of object is doing the reading; it's all about the side
    > effect. On the other hand, if there is an interface to apples rtf
    > parser (I've never seen anything like this) that would be very cool.

    The Cocoa RTF reader currently has no interface that would allow you
    to obtain custom attributes from an RTF file.  You would need to do
    your own RTF parsing.

    Douglas Davidson
previous month october 2006 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today