Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
XML Parse problem - invalid character
Message
De
06/10/2006 15:15:49
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01159360
Message ID:
01160202
Vues:
19
Thanks for your help, Sergey.


I think I resolved that problem now. This self-generating code will clean up a SQL cursor before creating XML. In the instance below, I was converting the [statemnt] table, though it can be generalized easily. The Gencode function generates the script to do STRTRAN on any character-type fields to remove ascii characters < 31.

Naturally, I am finding that XMLTOCURSOR is inappropriate for larger data sets. I did a UT search and found that out, but I don't have an easy alternative for converting back to a cursor. This table has about 400,000 records. The XML compresses really well. I can zip a 300MB xml file to a 20mb zip and download it, now I just need to re-convert it on my end. Is there another approach that might be more fruitful?
Close Tables All
Close Databases All
Clear All
Release All
Set Classlib To
CLEAR
Use l:\Shared\statemnt In 0
Select * From statemnt Into Cursor mystmt Readwrite
SELECT MYSTMT
LOCAL cScript, cXMLFile
cScript = GENCODE1()
cXMLFile = [c:\crap\]+ALLTRIM(ALIAS())+[.xml]
EXECSCRIPT(cScript)
Cursortoxml(ALIAS(),cXMLFile,1,512,0,[1])

FUNCTION gencode1
	Local lncount, laFldArray(2), cText

	cText = ''
	lncount = Afields(laFldArray,Alias())

	TEXT TO cText NOSHOW ADDITIVE TEXTMERGE
LOCAL i
Select <<ALIAS()>>
FOR i = 1 TO 31 

	ENDTEXT

	For I = 1 To lncount
		If Inlist(laFldArray(I,2),[C],[M],[V])
			TEXT TO cText NOSHOW ADDITIVE TEXTMERGE
	REPLACE <<laFldArray(I,1)>> with STRTRAN(<<laFldArray(I,1)>>,CHR(i),SPACE(1)) ALL 

			ENDTEXT
		Endif
	Endfor
	TEXT TO cText NOSHOW ADDITIVE TEXTMERGE
ENDFOR 
		
	ENDTEXT
RETURN CTEXT

EndFUNC
Jim Newsom
IT Director, ICG Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform