Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML DOM Not Working Right with FileToStr()
Message
From
04/04/2002 11:33:22
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
04/04/2002 10:47:14
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00640665
Message ID:
00640931
Views:
42
Reverse :)
CREATE CURSOR myCursor (mydata m nocptrans)
APPEND BLANK
APPEND memo myData FROM "c:\Windows\media\notify.wav"
CURSORTOXML('myCursor','it.xml',1,512,0,'1')

XMLTOCURSOR('it.xml','myGetBack',4+512+1024)
SELECT myGetBack
STRTOFILE(myGetBack.myData,'new.wav')
PS: Explicitly not wrapped in CDATA section.
Cetin

>Cool idea, Cetin ...
>
>But, now I'm messing around with it trying to figure out how to turn the XML string back into binary. So far, I've not found the right combination of XMLTOCURSOR() and STRTOFILE() parameters ... any quick solution so I don't fiddle around with this all day? <g>
>
>~~Bonnie
>
>
>>>I am trying to get a binary file into my XML document from inside my VFP .prg and I think I am seeing an interface incompatibility. What do you think?
>>>
>>>Fails with
>>>"OLE IDispath exception code 0 from msxml4.dll: Error parsing 'RIFFp0 ' as bin.base64 datatype"
>>>
>>>I thought this was supposed to convert binary automatically to base64?
>>>
>>>
>>>
>>>
>>>oSendDoc =  CreateObject("Msxml2.FreeThreadedDOMDocument.4.0")
>>>oSendDoc.SetProperty("SelectionLanguage" , "XPath")
>>>oRootElement = oSendDoc.createElement("xml")
>>>oRoot = oRootElement
>>>oSendDoc.appendChild(oRoot)
>>>oXmlPI = oSendDoc.createProcessingInstruction("xml", "version='1.0'")
>>>oSendDoc.insertBefore(oXmlPI, oSendDoc.childNodes(0))
>>>oEnvElement = oSendDoc.createElement("envelope")
>>>oEnvElement.DataType = "bin.base64"
>>>oEnvElement.NodeTypedValue = FileToStr("c:\winnt\media\notify.wav")
>>>oRoot.appendChild( oEnvElement )
>>>oSendDoc.Save("it.xml")
>>>
>>
>>Steve,
>>I don't think it'd automatically convert. You'd need to do conversion yourself. Hoping you have VFP7 a simplier way :
>>
>>CREATE CURSOR myCursor (mydata m nocptrans)
>>APPEND BLANK
>>APPEND memo myData FROM "c:\Windows\media\notify.wav"
>>CURSORTOXML('myCursor','it.xml',1,512,0,'1')
>>
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform