Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create XML from 2.x
Message
 
To
08/12/2006 15:27:00
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
01176033
Message ID:
01176252
Views:
16
>OK, thanks, I've got it!

Sorry I forgot to put spaces in the escaped character so you could see it;

& # 235; OR & euml; (take the spaces out)




>
>>It has nothing to do with VFP, is has to do with the ë being and invalid character in XML. You need to escape that character by using ë or ë oryou need to put the name tag in a CDATA enclosure as in;
>>
>>
>>=fputs(lnFile,'<?xml version="1.0" encoding="UTF-8" ?>')
>>=fputs(lnFile,[	<DATA>])
>>=fputs(lnFile,[		<DOC_ATTR>])
>>
>>=fputs(lnFile,[			<NAME_1><![CDATA[Curiël]]></NAME_1>])
>>OR
>>=fputs(lnFile,[			<NAME_1>Curiël</NAME_1>])
>>OR
>>=fputs(lnFile,[			<NAME_1>Curiël</NAME_1>])
>>
>>=fputs(lnFile,[		</DOC_ATTR>])
>>=fputs(lnFile,[	</DATA>])
>>
>>=fclose(lnFile)
>>
>>
>>>Hello,
>>>
>>>I am trying to create an XML file in foxPro 2.x:
>>>
>>>lnFile = fCREATE("test.txt",0)
>>>
>>>=fputs(lnFile,'<?xml version="1.0" encoding="UTF-8" ?>')
>>>=fputs(lnFile,[	<DATA>])
>>>=fputs(lnFile,[		<DOC_ATTR>])
>>>=fputs(lnFile,[			<NAME_1>Curiël</NAME_1>])
>>>=fputs(lnFile,[		</DOC_ATTR>])
>>>=fputs(lnFile,[	</DATA>])
>>>
>>>=fclose(lnFile)
>>>
>>>
>>>However, the file that I created this way cannot be opened as a XML file. What I noticed is that if I create the same file in VFP, the file is correct. But created with FoxPro 2.6, it gives this error (in IE):
>>>
>>>An invalid character was found in text content. Error processing resource 'file:///H:/projects/PRNEW/TEST.xml'. Line 4, Po...
>>>
>>>   <NAME_1>Curi
>>>
>>>
>>>
>>>
>>>Has anybody an idea what I could do about that?
Previous
Reply
Map
View

Click here to load this message in the networking platform