Note that there are some explanatory texts on larger screens.

plurals
  1. POXML Parsing, Joining elements in iOS
    primarykey
    data
    text
    <p>I've been trying to figure this out for a little while, but can't work it out. Hopefully someone on here will have an idea.</p> <p>I have some XML data that i am parsing, It looks like:</p> <pre><code> &lt;Name&gt;MAC 101&lt;/Name&gt; &lt;Modes&gt; &lt;Mode&gt; &lt;Name&gt;Basic RGB&lt;/Name&gt; &lt;ChannelCount&gt;8&lt;/ChannelCount&gt; &lt;/Mode&gt; &lt;Mode&gt; &lt;Name&gt;Raw RGB&lt;/Name&gt; &lt;ChannelCount&gt;12&lt;/ChannelCount&gt; &lt;/Mode&gt; &lt;/Modes&gt; </code></pre> <p>What I am doing is saving the info to an SQLite database, However i need to combine some info into 1 string first. I need the string to look like: (with the line break)</p> <p>8 Basic RGB <br>12 Raw RGB</p> <p>However sometimes there will be multiple "Modes" this example only has 2, sometimes it could be a dozen or more. </p> <p>The current code i'm using is NSXMLParser:</p> <pre><code>-(void) parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if (isStatus) { if ([elementName isEqualToString:@"Name"]) { CurrentFixture.Title = currentNodeContent; NSLog(@"Name: %@",currentNodeContent); } if ([elementName isEqualToString:@"Name"]) { CurrentFixture.ModeName = currentNodeContent; NSLog(@"Mode Name: %@",currentNodeContent); } if ([elementName isEqualToString:@"ChannelCount"]) { CurrentFixture.ChannelCount = currentNodeContent; NSLog(@"Channel Count: %@",currentNodeContent); } } if ([elementName isEqualToString:@"Fixture"]) { NSLog(@"Do something with data."); [self.data addObject:CurrentFixture]; NSLog(@"Data: %@",); CurrentFixture = nil; currentNodeContent = nil; } } </code></pre> <p>The Mode name will be changing tags so it doesn't get confused with the actual name, But at the moment I just need to get something working. Any advise or guidance would be much appreciated. Thanks Andrew</p>
    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. 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