i have XML file and i'm reading from NSXMLParser
this is my code
import UIKit
class ***: UIViewController ,UITableViewDelegate, UITableViewDataSource,NSXMLParserDelegate {
@IBOutlet weak var Liste: UITableView!
var strXMLData:String = ""
var currentElement:String = ""
var passData:Bool=false
var passName:Bool=false
var parser = NSXMLParser()
var userList: [S_Arsiv_Nesne] = []
func firstMethodforXML(){
var urlToSend: NSURL = NSURL(string: ServerBilgileri().Arsiv)!
// Parse the XML
parser = NSXMLParser(contentsOfURL: urlToSend)!
parser.delegate = self
var success:Bool = parser.parse()
if success {
println("parse success!")
println(strXMLData)
} else {
println("parse failure!")
}
self.Liste.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
self.Liste.dataSource = self
}
override func viewDidLoad() {
super.viewDidLoad()
firstMethodforXML()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return userList.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell:UITableViewCell = self.Liste.dequeueReusableCellWithIdentifier("cell") as UITableViewCell
cell.textLabel?.text = self.userList[indexPath.row].ARSIV_ADI
return cell
}
func parser(parser: NSXMLParser!, didStartElement elementName: String!, namespaceURI: String!, qualifiedName qName: String!, attributes attributeDict: [NSObject : AnyObject]!) {
if elementName == "ARSIV_ADI" {
passData = true
}
}
func parser(parser: NSXMLParser!, didEndElement elementName: String!, namespaceURI: String!, qualifiedName qName: String!) {
if elementName == "ARSIV_ADI" {
passData = false
}
}
func parser(parser: NSXMLParser!, foundCharacters string: String!) {
var Nesne: S_Arsiv_Nesne
var deneme: String = string!
if passData == true {
Nesne = S_Arsiv_Nesne(ARSIV_ID: 0, ARSIV_ADI: string, ARSIV_KATEGORILER_ID: 0, ARSIV_ICERIK: "", ARSIV_YAZAR: "", ARSIV_TARIH: "", ARSIV_AKTIF: 0)
userList.append(Nesne)
}
}
}
this is my XML
<ARSIV_ADI>30 günle sağlık yardımı</ARSIV_ADI>
but screenshot is this
when it sees UTF-8 character like 'ü' jump another row and continue sentence how can i fix this ? I didn't explain some object in code but in my opinion it doesn't necessary .Thank you.