Displaying Images in XML file.

A

AnandSancheti

Hello all
I am new to XML and Web technology in general. I want to know how can
we display an image in the XML file. In this case constraint is that no
file is to be used as a link. rather image data should be part of the
XML file. and this file would be generated runtime. this file would be
created by some application in order to display the images.

Thanks in advance.

Anand Sancheti
 
D

David Dorward

AnandSancheti said:
I am new to XML and Web technology in general. I want to know how can
we display an image in the XML file. In this case constraint is that no
file is to be used as a link. rather image data should be part of the
XML file

The data: url scheme and SVG spring to mind.
 
M

Martin Honnen

AnandSancheti said:
I am new to XML and Web technology in general. I want to know how can
we display an image in the XML file. In this case constraint is that no
file is to be used as a link. rather image data should be part of the
XML file. and this file would be generated runtime.

Well there is SVG (<http://www.w3.org/TR/SVG/), which is an XML
application defining scalable vector graphics. Viewers for that are
Batik or the Adobe SVG viewer.
Recently browsers start supporting some SVG too, the upcoming Firefox
1.5 will have native SVG support, Opera 8 has support for SVG Tiny,
Opera 9 Preview has improved support (in particular for scripting).
In those browsers you can render mixed namespace documents with elements
in the XHTML namespace and with elements in the SVG namespace.

Where exactly do you "display" your XML currently? Do you use an XML
application like XHTML that is meant to be displayed? Or do you
transform your XML to HTML to display it?
 
M

mgungora

I think Anand wants to embed an image data into the XML file, rather
than creating an image in XML. If that's the case, Anand, you should
encode the image data, probably in base64, and put it into the XML file
just like a text node. Then, the application that reads the XML text
would decode the image data back to its binary form and display it or
pass it to some other application that can.

-murat
 
A

AnandSancheti

Hello all
thanks A lot for your replies suggestions and guidence. I guess I have
not made myself clear and will again describe the situation.
Given an Image I want to display it such that it would not be the
filename of the image in the XML rather "Pixel data in the XML". Is
this possible in XML. As martine asked wheather it would be XHTML or
HTML. I would be transforming XML to HTML.

I hope this makes me clear
Once again thanks for your valuable comments.

Best Regards
Anand Sancheti
 
M

Martin Honnen

AnandSancheti wrote:

Given an Image I want to display it such that it would not be the
filename of the image in the XML rather "Pixel data in the XML". Is
this possible in XML. As martine asked wheather it would be XHTML or
HTML. I would be transforming XML to HTML.

So in the end you have HTML to be rendered in a browser and want to have
an image rendered in an HTML document where the data is provided inline
and not by a URL to an image file.
That David's suggestion about the data: URL is a solution, at least in
theory, as IE/Win for instance does not support data: URLs so far I think.
data: URLs are specified here:
<http://www.faqs.org/rfcs/rfc2397.html>

Netscape 4 supports them, Mozilla does, Opera 8, but as said IE/Win not.
 
P

Peter Flynn

AnandSancheti said:
Hello all
thanks A lot for your replies suggestions and guidence. I guess I have
not made myself clear and will again describe the situation.
Given an Image I want to display it such that it would not be the
filename of the image in the XML rather "Pixel data in the XML". Is
this possible in XML.

Not directly. See the FAQ at http://xml.silmaril.ie/authors/graphics/

As others have already explained, the only ways of storing image data
in an XML document instance are by encoding it, by using SVG, or with
the data: scheme. XML is a text document format, not a graphics format.

///Peter
 
A

AnandSancheti

Hi Peter
I could not get your reply
What do you mean when you say after Encoding it?
I have some Image which has got some specific header + JPEG image data.
I will read JPEG part in the memory. Now I want to display the same in
to a XML/HTML page with the restriction that we cannot create a
temorary file. (with temorary file it would have been easier as we can
use the link inside XML)

With this how can I go ahead?

Thanks
Regards
Anand Sancheti
 
D

David Dorward

AnandSancheti said:
I could not get your reply

It's at said:
What do you mean when you say after Encoding it?

I suspect he meant converting it to a form that can be represented by 7-bit
ACSII.
I have some Image which has got some specific header + JPEG image data.
I will read JPEG part in the memory. Now I want to display the same in
to a XML/HTML page with the restriction that we cannot create a
temorary file.
With this how can I go ahead?

As mentioned previously - using the data: url scheme is probably the best
solution (with the widest level of support, although that doesn't extend to
Microsoft Internet Explorer)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,001
Messages
2,570,254
Members
46,850
Latest member
VMRKlaus8

Latest Threads

Top