PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 25 → Wx - Procedure WS_ReadXml
Wx - Procedure WS_ReadXml
Iniciado por adrianoboller, ago., 28 2015 8:34 PM - 1 resposta
Membro registado
3.659 mensagems
Popularité : +175 (223 votes)
Publicado em agosto, 28 2015 - 8:34 PM
Procedure WS_ReadXml(XML_Retorno is string)

arrXml_TagResult is array of strings

busca01 is string = "<Row>"
busca02 is string = "</Row>"

xposicaoinicial is int = 0
Xposicaofinal is int = 0

X is int = 0
arrXml_Tag is array of strings


Inicial is int = PositionOccurrence(XML_Retorno,busca01,firstRank,FromBeginning)
Final is int = PositionOccurrence(XML_Retorno,busca02,lastRank,FromEnd)

XML_Retorno = Middle(XML_Retorno,Inicial,(Final + Length(busca02)) - Inicial)

XML_Retorno = "<Xml><Recorte><NoXml>"+XML_Retorno+"</NoXml></Recorte></Xml>"

nTotalxml is int = Length(XML_Retorno)

LOOP (nTotalxml)

X++
IFxposicaoinicial = 0 AND Xposicaofinal = 0 AND XML_Retorno[[X]] = "<" THEN
X++
IF XML_Retorno[[X]] = "/" THEN
xposicaoinicial = X + 1
END
END
IF xposicaoinicial > 0 AND XML_Retorno[[X]] = ">" THEN
Xposicaofinal = X
END
IF Xposicaofinal > 0 AND xposicaoinicial > 0 THEN
stag is string = Middle(XML_Retorno,xposicaoinicial,Xposicaofinal - xposicaoinicial)
IF stag="NoXml" THEN
BREAK
END
Add(arrXml_Tag, stag)
Xposicaofinal = 0
xposicaoinicial = 0
END

END

XmlDoc is XMLDocument
XmlDoc = XMLOpen(XML_Retorno, fromString)
NoXml is xmlNode

FOR EACH NoXml OF XmlDoc.Xml.Recorte on NoXml

FOR EACH sTag OF arrXml_Tag

Add(arrXml_TagResult,NoXml..ChildNode[sTag])

END

END



RESULT arrXml_TagResult
Membro registado
3.659 mensagems
Popularité : +175 (223 votes)
Publicado em agosto, 28 2015 - 9:41 PM
Prezados,

segue alguns links:

http://help.windev.com/en-US/…

http://help.windev.com/en-US/…

http://help.windev.com/en-US/…

http://help.windev.com/en-US/…

Informações complementares, lembro pra se aterem aos retornos se estao vindo wm UTF-8, Ansi ou Unicode ai tem que converter se não vai aparecer codigo japones.... rsss...

[ ]´s

Adriano Boller