Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 1 Woche, 3 Tagen
Letzter Beitrag:
vor 1 Woche, 2 Tagen
Beteiligte Autoren:
David Cabrera, Fabrice Harari, kingdr

[WM22] Problem reading XMLs in iOS

Startbeitrag von David Cabrera am 10.07.2017 20:27

Good afternoon

I have the following problem, I use XMLs in WebServices in WinDev Mobile 22, Android work well because there the project was developed first, then the same content was passed to an iOS project, there is no compilation error, but the reading of XMLs does not work.

It works well in the iOS emulator but not in the device, debugging with infos it could be noticed that it does not enter the for each.

My code is as follows:

---------------------------------------------------------------------------

sResultado is string = Login(EDT_EMP_CLAVE,EDT_EMP_PASSWORD,0)

ResXML is xmlDocument
ResXML = XMLOpen(sResultado,fromString)
nResultado is int = StringCount(sResultado,"",IgnoreCase + WholeWord)

nCLI_NUM_CTRL is int
sCLI_NOMBRE is string
sResultadoBoolean is string
DatosLogin is xmlNode

FOR EACH DatosLogin OF ResXML
Info(DatosLogin)
FOR i = 1 _TO_ nResultado
Info(DatosLogin.DatosLogin.Resultado)
Info(DatosLogin.DatosLogin.CLI_NUM_CTRL)
Info(DatosLogin.DatosLogin.CLI_NOMBRE)

sResultadoBoolean = DatosLogin.DatosLogin.Resultado
nCLI_NUM_CTRL = DatosLogin.DatosLogin.CLI_NUM_CTRL
sCLI_NOMBRE = DatosLogin.DatosLogin.CLI_NOMBRE
END
END
Info(sResultadoBoolean)
IF sResultadoBoolean ~= "TRUE" THEN
...

------------------------------------------------------------------------

As it does not enter the cycle, the variable is always false
Does anyone have a solution to this?

Thanks in advance

Antworten:

Hi David,

your problem is not about XML, it's about the type of stirngs, if I'm not mistaken.
Under IOS, a string, by default, is a UTF 8 unicode thingy, which is NOT what has been sent by your webservice.

So as usual, the solution is to change the encoding with a utftounicode to equivalent function AFTER receiving it, but BEFORE processing it with the XML functions.

Best regards

von Fabrice Harari - am 10.07.2017 20:55
Hi Fabrice, thanks for answer.

in the WebService I have this lines

-----------------------------------------------------------------------------------------

sXMLInfo = XMLBuildString("Login",XMLDocumentDefault,XMLEncodingIso8859_1)
XMLClose("Login")
RESULT sXMLInfo

-----------------------------------------------------------------------------------------

you say i need to change, in this case Iso8859_1 to UTF8 ?
in that case, I tried changed that line directly in the webservices for this line

-----------------------------------------------------------------------------------------

sXMLInfo = XMLBuildString("Login",XMLDocumentDefault,XMLEncodingUTF8)

-----------------------------------------------------------------------------------------

but it doesn´t work too.

von David Cabrera - am 10.07.2017 21:40
Hi

What's the declaration of sXMLInfo or you may try out as below

sXMLinfo =UTF8ToString(XMLBuildString("Login",XMLDocumentDefault,XMLEncodingUTF8)
, charsetAnsi)

// if sXMLInfo is string

info(sXMLInfo) // to see it's ok

HTH

King

von kingdr - am 11.07.2017 00:41
Hi David,

no, I did NOT say to change ANYTHING in the webservice...

I said to change something in the IOS code. And I repeat:

So as usual, the solution is to change the encoding with a utftounicode to equivalent function AFTER receiving it, but BEFORE processing it with the XML functions.

Best regards

von Fabrice Harari - am 11.07.2017 12:42
We already solved it.

Thanks !

von David Cabrera - am 11.07.2017 17:38
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.