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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to load image file into XML Document?

Status
Not open for further replies.

longintbg

Programmer
Jul 2, 2003
2
BG
The problem is how to load image(*.bmp, *.jpeg or anything ) into a node in xml document.(Just like TClientDataSet do it when a Field is Blob)I've used XMLDatabinding Wizard and created a pas file from the xml schema. The node type is hexBinary. I cannot simply do something like this:

procedure CreateXML;
var
CmdNode: IXMLCmdType;begin

with DMClient.XMLDoc do
begin

Active:= True;
ChildNodes.Clear;
CmdNode := GetCommand( DMClient.XMLDoc);

with CmdNode do
begin
CmdIndex:= IntToStr(Cmd);
with Params.Group do
begin
Name:= aGroupName;
Image:=// <-----???
end;
end;

Version:='1.0';
SaveToStream(cmdStream);
Active := False ;

end;

end;
 
You basically need to encode the image file with base64 encoding to pass the binary file as text in your XML file. Have a look at this link - it should be a similar process in Delphi.

Can we store an image in a XML file

Let me know if you're still struggling.

Hope this helps!

Clive [infinity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer."
Paul Ehrlich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top