Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your code assumes that <code>foundCharacters</code> returns the entire value for an element in a single call. This is not a valid assumption (especially for long values). This is why you're only seeing the end of the <code>content</code> tag, because the rest of the value was returned in prior calls to <code>foundCharacters</code>, but you discarded that on each subsequent call to <code>foundCharacters</code>.</p> <p>For a long value, the sequence of events is (a) a call to <code>didStartElement</code>; (b) multiple calls to <code>foundCharacters</code> until the whole value is returned; and finally (c) a call to <code>didEndElement</code>.</p> <p>So:</p> <ol> <li><p>Have <code>didStartElement</code> initialize <code>currentNodeContent</code> if it encounters either the <code>title</code> and <code>content</code> element names:</p> <pre><code>currentNodeContent = [[NSMutableString alloc] init]; </code></pre></li> <li><p>Then, <code>foundCharacters</code> should just append the <code>string</code> to <code>currentNodeContent</code>:</p> <pre><code>[currentNodeContent appendString:string]; </code></pre> <p>NB: Make sure it does <em>not</em> trim the string (if you want to trim, do that in <code>didEndElement</code>, not in <code>foundCharacters</code>).</p></li> <li><p>Have <code>didEndElement</code> save the <code>currentNodeContent</code> if the element name is <code>title</code> or <code>content</code> and it should also then set <code>currentNodeContent</code> to <code>nil</code>.</p></li> </ol>
    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.
 

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