Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
About using StrToFile() while creating XML file
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
About using StrToFile() while creating XML file
Miscellaneous
Thread ID:
01086843
Message ID:
01086843
Views:
73
Hi All,

i wantto merge some text and cursor results in a one string, also string should be at first row of xml file
(this xml file will use for send sms)


this syntax works fine while Xml Post
lcfile = [ <?xml version="1.0"?> ]+;
[<MainmsgBody>]+;
[<UserName>xxxx</UserName>]+;
[<PassWord>yyyy</PassWord>]+;
[<Messages>]+;
[<Message>]+;
[<Mesgbody>some bla bla...</Mesgbody>]+;
[<Number>09991234567</Number>]+;
[</Message>]+;
[<Message>]+;
[<Mesgbody>some bla bla...</Mesgbody>]+;
[<Number>09991234567</Number>]+;
[</Message>]+;
[</Messages>]+;
[<Type>1</Type>]+;
[<Originator></Originator>]+;
[<Sdate></Sdate>]+;
[<Edate></Edate>]+;
[</MainmsgBody>  ]
but when create need xml file via below codes
Set Safety Off

Local LcXmlFileHeader,LcXmlFileBody,LcXmlFileFooter
Local LcUrl,LcUsrName,LcPasswd,LcXMLFile,httpOb,LnBakiye,LcGSM,LcUnvan,LcMessage,LcPageMulti

LcXmlFile = "XML_Multi.xml"

Select * From Addbs(m.gcData)+'sms' Into Cursor CrsSMS NOFILTER

LcUrl = Alltrim(CrsSMS.url)
LcPageMulti= Alltrim(CrsSMS.pagemulti)
LcUrl = LcUrl + LcPageMulti

LcUsrName = Alltrim(CrsSMS.usrname)
LcPasswd = Alltrim(CrsSMS.passwd)

LcXmlFileHeader = [ <?xml version="1.0"?> ]+;
				[ <MainmsgBody> ]+;
				[ <UserName>&LcUsrName</UserName> ]+;
				[ <PassWord>&LcPassWd</PassWord> ]+;
				[ <Messages> ]

Strtofile(m.LcXmlFileHeader,m.LcXmlFile)

Select CrsResult &&assumed there is 2 result of query
Go Top

LnBakiye = CrsResult.Bakiyeborc
LcGSM = Alltrim(CrsResult.gsm)
LcUnvan = Alltrim(CrsResult.cadi)
LcMessage = "Sayin " + m.LcUnvan + " " + Dtoc(Date()) + " Tarihi Itibari Ile Bakiyeniz... " + ;
IIF(m.LnBakiye>0," (B) "," A ") + ALLTRIM(trans(m.LnBakiye,"999,999,999.99")) + " YTL dir..."


Set Textmerge On
Set Textmerge To (m.LcXmlFile) Noshow Additive &&adding to the existing xml file

For i=1 To Reccount('CrsResult')
\<Message><Mesgbody><<m.LcMessage>></Mesgbody><Number><<m.LcGSM>></Number></Message>
	Skip In CrsResult
Endfor
Set Textmerge To
Set Textmerge Off

LcXmlFileFooter = [ </Messages> ]+;
				[ <Type>1</Type> ]+;
				[ <Originator></Originator> ]+;
				[ <Sdate></Sdate> ]+;
				[ <Edate></Edate> ]+;
				[ </MainmsgBody> ]

Strtofile(m.LcXmlFileFooter,m.LcXmlFile, .T.) &&additive is .t. or 1

Modify Command &LcXmlFile
it doesnt works and it looks while xml post

So,
how can i merge pre ready strings ( for header and footer ) and cursor results in a one string ?
is there any method for this strtofile or any each other..

TIA
Next
Reply
Map
View

Click here to load this message in the networking platform