1

I am storing in an array information parsed from a XML file that has some strings containing special characters like the spanish eñe. When I print the result of the parsed string using the XMLParserDelegate methods I get the string divided into two new strings like so:

01-PLAZA LEVANTE
02-IRU                  // These two should
ÑA                      // be together
03-AYUNTAMIENTO
04-PLAZA ARRIAGA
05-SANTIAGO COMPOSTELA
06-PLAZA REKALDE
07-DR. AREILZA
08-ZUNZUNEGI
09-ASTILLERO
10-EGUILLOR
11-S.  CORAZON
12-PLAZA INDAUTXU
13-LEHENDAKARI LEIZAOLA
14-CAMPA IBAIZABAL
15-POLID. ATXURI
16-SAN PEDRO
17-KARMELO
18-BOLUETA
19-OTXARKOAGA
20-OLABEAGA
21-SARRIKO
22-HEROS
23-EGA              // The same for
ÑA                  // this ones
24-P.ETXEBARRIA
25-TXOMIN GARAT
26-ABANDO
27-ESTRADA CALEROS
28-EPALZA
29-IRALA

The code in the method contains the following code:

func parser(_ parser: XMLParser, foundCharacters string: String) {

    if element == "NOMBRE" {
        stationNameTEMP = string
        print("\(string)")
    }
}

The XML file in the header specifies the encoding and it's: ISO-8859-1

javierdemartin
  • 595
  • 6
  • 24
  • 1
    The parser:foundCharacters: delegate method can be called more than once for a single XML element, that is normal behaviour. – Martin R Jul 29 '16 at 12:13

0 Answers0