Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSXMLParserDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/NSXMLParserDelegate" rel="nofollow">documented design choice from Apple</a>, and has nothing to do with Swedish characters:</p> <blockquote> <p>Because <em>string</em> may be only part of the total character content for the current element, you should append it to the current accumulation of characters until the element changes.</p> </blockquote> <p>So you should do just as they say: use a <code>NSMutableString</code> to accumulate the results, and when the element changes, save the buffer to a permanent, (preferrably) immutable <code>NSString</code>.</p> <p>As requested, here's an example. It was written without any kind of IDE, so chances are that it'll work, but there's no guarantee that it will either compile or work.</p> <pre><code>@interface Foo : NSObject&lt;NSXMLParserDelegate&gt; { NSMutableString* accumulator; NSMutableArray* schemaInfoArray; int uppraknare; // whatever 'uppraknare' means } /* snip */ @end @implementation Foo -(void)parser:(NSXMLParser*)parser foundCharacters:(NSString*)string { // only accumulate characters, until we get notified that we went through // the whole XML element [accumulator appendString:string]; } -(void)parser:(NSXMLParser*)parser didEndElement:(NSString*)elementName namespaceURI:(NSString*)nsuri qualifiedName:(NSString*)qName { // we went through the whole element! time to save! NSString* immutableResult = [accumulator copy]; [schemaInfoArray insertObject:immutableResult atIndex:uppraknare]; uppraknare++; [immutableResult release]; // clear the accumulator for the next element [accumulator deleteCharactersInRange:NSMakeRange(0, [accumulator length])]; /* the rest of your code here */ } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload