Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML - I NEED TO EXTRACT IMAGE FROM XML

Status
Not open for further replies.

narenkv

Programmer
Sep 20, 2002
43
0
0
IN
I need to extract an image which is present in binary format in XML file. How do I do it.

Following statement does not allow me to execute

singlenode = createobject('MSXML.IXMLDOMNode')

It prompts me an error , How do I resolve it


Thanks
NAREN
 
As Mike mentioned, this may be a question better suited for another forum. However - If you provide us with more information, including the code you are working on we may be able to assist. The one line by itself does not provide us much information.



Jim Osieczonek
Delta Business Group, LLC
 
Hi All

Thanks for the replies

As the same statement 'MSXML.IXMLDOMNode' of creating the node is working fine with VisualBasic . Here in foxpro it prompts me as an error I dont know why it is not supported in VFP ???

Is there any other method in VFP to extract image from XML

Thanks Again

NAREN
 
Hi All

I have attached code with a little part of XML.
The same type of code is working with VB. Now I am facing problems of deriving values of IMAGE tag

Output.xml contains values with Jpeg file

Example like :-

<Image ImageFormat=&quot;JPEG&quot; dt:dt=&quot;bin.base64&quot; xmlns:dt=&quot;urn:schemas-microsoft-com:datatypes&quot;>/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoM </Image>

oXML = CreateObject('Microsoft.XMLDOM')
If oXML.Load('C:\Output.xml')
mynode=oxml.selectsinglenode('//Image ')
if ISNULL(mnode)
wait wind 'IMAGE NOT SELECTED'
else
obj_Stream=createobj('ADODB.Stream')
obj_Stream.Type=1
obj_Stream.open
obj_Stream.write(mynode.nodeTypedValue)
obj_Stream.SaveToFile(&quot;C:\outfile2.jpeg&quot;)
obj_Stream.Close
obj_Stream = NULL
endif
Else
wait wind (&quot;response file not loaded&quot;)
EndIf
 
Yes Mike

Thanks for your reply

I modified the code . So my problem now is

mynode=oxml.selectsinglenode('//Image ') is not working fine
i.e mynode array is not being created . If this works fine then my problem will be solved

Can u advise me.

Thanks
NAREN
 
Naren,

Your code looks completely OK to me. However, you mentioned that selectSingleNode() was not creating the MyNode array. SelectSingleNode() creates an object (a node object), not an array. But that doesn't alter the code in any way, as far as I can see.

Mike


Mike Lewis
Edinburgh, Scotland
 
Yes Mike

Thanks for your reply

Now my problem is I need to open that MyNode object in binary mode and write to a file.

With Adodb Stream I am unable to extract to an image

Thanks
NAREN
 
Yes Mike

You are correct , How do I pass that object as array to adodb stream ?


Thanks
NAREN
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top