473,236 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

image and binary data

I, guys.

I've embeded an image into a xml file, something like that:
<display type="picture" mime="image/png" name = "mosaico6.png">
<![CDATA[ ....my binary data ... ]]>
</display>

Now, I want to display it with a XSL Transformation, but my code don't work:
<display>

<xsl:attribute name="mime">
<xsl:value-of select="@CDATA"/>
</xsl:attribute>
</display>

Can, anyone help me?

thanks in advance.
Maurizio.

Jul 20 '05 #1
9 9679
On 26/01/2004, around 16:58, Maurizio Penna wrote:

MP> Now, I want to display it with a XSL Transformation
A quick search of google suggests you can't although I only spend a
minute or 2 looking. You might find more there is some discussion
about doing almost exactly what you're talking about here
http://lists.w3.org/Archives/Public/...3Jul/0024.html

--
Stuart
The problem with asking other people for their opinions is that they
frequently give them!

Jul 20 '05 #2

"DFN-CIS NetNews Service" <sh******@estatecomputers.com> ha scritto nel
messaggio news:19***********************@estatecomputers.com ...
On 26/01/2004, around 16:58, Maurizio Penna wrote:
A quick search of google suggests you can't although I only spend a
minute or 2 looking.


Thanks for the help.
I've spended more than 2 minutes on googles to search something. Your link
don't solve my problem.

I'm sorry for my poor english. so I rewrite my problem:
I must display an image that lives into the xml file, in a CDATA section.
And I must use a xslt files to display it. I don't now how to say to the
xslt file that my image is into the CDATA section.

For your help, I invite you to see this article: Embed binary data in XML
documents three ways. At
http://www-106.ibm.com/developerwork...ary/index.html (that
I've founded with a google's search).
The second way is my goal, but I don't know, how to construct the xslt file
(Listing 5. Output format 2: agentproduct2.xml) to visualize the xml file in
IE.

Regards,
Maurizio.
Jul 20 '05 #3
On 26/01/2004, around 09:24, Maurizio Penna wrote:

MP> For your help, I invite you to see this article: Embed binary data in XML
MP> documents three ways.
In that document you are pointed at the file
http://www-106.ibm.com/developerwork.../binaryxml.zip
which contains all that was used to generate the example. The author
seems to use some Java code to do the work. Maybe you'll find the
answers there.
--
Stuart Why is there so much month left at the end of the money?

Jul 20 '05 #4
In article <ne********************@listsrv01.csi.it>,
Maurizio Penna <ma********************@hotmail.com> wrote:

% I'm sorry for my poor english. so I rewrite my problem:
% I must display an image that lives into the xml file, in a CDATA section.

You have a problem here. There are certain characters which are likely
to appear in your image, but which are not permitted in an XML file.
It doesn't matter whether you put CDATA around them or not -- the
characters are simply not allowed, and there's nothing you can do about
it. You can't even use a character reference (� is not permissible,
for instance). You need to convert to an ascii format when you're embedding
binary data.

% And I must use a xslt files to display it. I don't now how to say to the
% xslt file that my image is into the CDATA section.

XSLT doesn't know, and shouldn't be able to know, when you're using a CDATA
section. You need to identify your data by the element of which it's part.
Having said that, XSLT can be used to extract the image data from your
original file, but it can't do much with it -- it might be able to
convert it back to binary format given enough work, but it certainly can't
display it, and in XSLT 1.0 it can't write each image to a separate file,
if there's more than one image in the XML file. It doesn't sound like it's
an appropriate or useful tool for your problem.

% For your help, I invite you to see this article: Embed binary data in XML
% documents three ways. At
% http://www-106.ibm.com/developerwork...ary/index.html (that

I glanced briefly at this article, and I'd say it's not worth reading.

What you want to do, and what the author of the article is actually
doing in his CDATA example (Listing 5), is to convert the binary data into
MIME base 64 encoding. This is a text format which can be included anywhere
text is allowed in an XML document. No CDATA section is required.

When you generate your XML file, you convert the image to mime base64
(there are libraries for doing this all over the place -- which one you
use depends on what language you're working with), then include the
resulting text like any other text.

<image>/9j/4AAQSkZJRgABAgEASABIAAD/2wBDABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8R
DAwMDAwMEQwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/2wBDAREPDxETERUSEhUUDg4O
...
RqhJSQesx30juD8TsA/ulVPz8zfzTU62+zT6VrKK2tt6IiAscn3uVPdSYPUtc17m4MLCx L8w
IPN96Xwx5kLyvsMg+f5Qb/shHSPEi7w9DGw/4wIDDGzoOkAGxQ7RSQP/2Q==
</image>

when you want to display the image, you get the content of <image>,
convert it back to binary format, and pass that to the routines that
display the image.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #5
On 27/01/2004, around 16:12, Patrick TJ McPhee wrote:

PTM> when you want to display the image, you get the content of <image>,
PTM> convert it back to binary format, and pass that to the routines that
PTM> display the image.
Isn't it possible, say, to generate an multipart HTML document that
has base64 bits that can be referred to an displayed directly? Or is
that just a mail thing for attachments?

--
Stuart
Ladies, don't forget the rummage sale. It is a good chance to get rid
of those things not worth keeping around the house. Bring your
husbands.

Jul 20 '05 #6
In article <15**********************@estatecomputers.com>,
DFN-CIS NetNews Service <sh******@estatecomputers.com> wrote:
% On 27/01/2004, around 16:12, Patrick TJ McPhee wrote:
%
% PTM> when you want to display the image, you get the content of <image>,
% PTM> convert it back to binary format, and pass that to the routines that
% PTM> display the image.
% Isn't it possible, say, to generate an multipart HTML document that
% has base64 bits that can be referred to an displayed directly? Or is
% that just a mail thing for attachments?

multipart mime is purely a mail thing. If one of the parts is html,
and if you use a mailer which can display it and resolve <img> tags
to attachments, then you can do that. If you are not writing the code
to process the XML file, you need to embed the image however the code
that processes it wants it embedded. XML doesn't inherently have any
image processing capabilities.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #7
On 28/01/2004, around 17:00, Patrick TJ McPhee wrote:
PTM> XML doesn't inherently have any
PTM> image processing capabilities.
No, I appreciate that, I was thinking more in terms of HTML which
might be the final output from the XSL transform.

--
Stuart
It is generally inadvisable to eject directly over the area you just
bombed. - U.S. Air Force Manual

Jul 20 '05 #8
In article <83**********************@estatecomputers.com>,
DFN-CIS NetNews Service <sh******@estatecomputers.com> wrote:
% On 28/01/2004, around 17:00, Patrick TJ McPhee wrote:
% PTM> XML doesn't inherently have any
% PTM> image processing capabilities.
% No, I appreciate that, I was thinking more in terms of HTML which
% might be the final output from the XSL transform.

In the specific case of html, you might be able to use the data:
url described in RFC 2397. For instance, you can have

<img src='data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEASABIAAD/7RJC...
...
T8Md5MeU9GCbz+SbX7k44U7Crun4Kin/ACpIXTqKIOElMUk+iSKn/9k='>

and if your original XML file has the data as a base-64 encoded
jpeg file, xslt can be used to generate this. It will work with some
browsers, but not others.
--

Patrick TJ McPhee
East York Canada
pt**@interlog.com
Jul 20 '05 #9
On 29/01/2004, around 08:58, Patrick TJ McPhee wrote:

PTM> In the specific case of html, you might be able to use the data:
PTM> url described in RFC 2397.
Cool. I'll give that a go.

PTM> It will work with some browsers, but not others.
OK.

TVM.

--
Stuart
Sea captains don't like crew cuts.

Jul 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
7
by: MVM | last post by:
I am using SQL server and ASP to create a webpage and display images directly from the database. My code is working fine, the issue I am having is when a photo is not in the database. For...
13
by: Neo Geshel | last post by:
I have examined about 80+ different upload scripts on the 'net, both in VB and C#, and none seem to do what I need them to do. Perhaps someone here can point me somewhere that Google hasn't...
2
by: Chucker | last post by:
Hi Community, I think I can store Binary Data in SQL Server but when I try to retrieve it, I always only get one byte. I think I stored my Binary Data in SQL Server in a Colum of Type Image....
5
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into...
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
23
by: Peter | last post by:
I have a problem with a page show_image.asp that returns a jpg image under Windows XP Pro SP2. The page sets content type as: Response.ContentType = "image/jpg" While this works perfectly fine...
2
by: Roel | last post by:
Hi, I'm using the ASP.NET 2.0 profile system to keep an image of members of my website "MyWebsite". Initially, I've created the property in the web.config like: <add name="Photo"...
2
by: Ed | last post by:
Hope someone can help me out... I have been tasked to read some image data from an sql database and save the files to flat files. OK, sounds easy as I'v used BLOBs before. But this is an old...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.