Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Xmltocursor muito lento
Message
 
To
13/02/2004 07:48:28
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00876603
Message ID:
00877717
Views:
20
This message has been marked as the solution to the initial question of the thread.
Montei uma rotina aqui e cheguei a números aceitaveis:


Ambiente de teste:

Athon 2.4 - 256MB - WinXP
Cursor original -> 15923 Linhas com 35 colunas
XML Resultante -> 15.1MB

Usando apenas xmltocursor > 25 minutos (Não tive paciencia e fechei a aplicação :D)
Usando uma rotina de desmonte de XML: 28 Segundos

Já é um grande avanço :)

Segue rotina abaixo:
m.lcArquivo="c:\work\estoque.xml"
m.lcXML=filetostr(m.lcArquivo)
m.lcEsquema=strextract(m.lcXML,"","</xsd:schema>")+"</xsd:schema>"
xmltocursor(m.lcEsquema+"</VFPData>","cCursorXML")
m.lcCursor=strextract(strextract(m.lcXML,"</xsd:schema>",">"),"<","")
m.lnOcorrencias=occurs("<"+m.lcCursor+">",m.lcXML)
for m.loop1=1 to m.lnOcorrencias step 500
	m.lnInicio=at("<"+m.lcCursor+">",m.lcXML,m.loop1)
	m.lnFim=at("</"+m.lcCursor+">",m.lcXML,m.loop1+499)
	m.lcLinha = substr(m.lcXML,m.lnInicio,m.lnFim-m.lnInicio)
	if empty(m.lcLinha)
		exit
	endif
	xmltocursor(m.lcEsquema+m.lcLinha+"</"+m.lcCursor+">"+"</VFPData>","cXmlTemp")
	insert into cCursorXML select * from cXmlTemp
endfor
m.lnInicio=at("<"+m.lcCursor+">",m.lcXML,reccount("cCursorXML")+1)
m.lnFim=at("</VFPData>",m.lcXML)
m.lcLinha = substr(m.lcXML,m.lnInicio,m.lnFim-m.lnInicio)
if !empty(m.lcLinha)
	xmltocursor(m.lcEsquema+m.lcLinha+"</VFPData>","cXmlTemp")
	insert into cCursorXML select * from cXmlTemp
endif
use in xmltemp
Agora é só criar uma classe, alguns parametros e acho que esta beleza. Se tiver alguma sugestão, vamos baixar esses 28 segundos. Depois vou postar na área de downloads aqui na UT.
Cordialmente,

Fabiano Costa
Previous
Reply
Map
View

Click here to load this message in the networking platform