473,769 Members | 6,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.p ng">
<![CDATA[ ....my binary data ... ]]>
</display>

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

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

Can, anyone help me?

thanks in advance.
Maurizio.

Jul 20 '05 #1
9 9718
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******@estat ecomputers.com> ha scritto nel
messaggio news:19******** *************** @estatecomputer s.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.x ml) 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************ ********@listsr v01.csi.it>,
Maurizio Penna <ma************ ********@hotmai l.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/4AAQSkZJRgABAgE ASABIAAD/2wBDABALCwsMCxA MDBAXDw0PFxsUEB AUGx8XFxcXFx8R
DAwMDAwMEQwMDAw MDAwMDAwMDAwMDA wMDAwMDAwMDAwMD Az/2wBDAREPDxETERU SEhUUDg4O
...
RqhJSQesx30juD8 TsA/ulVPz8zfzTU62+z T6VrKK2tt6IiAsc n3uVPdSYPUtc17m 4MLCxL8w
IPN96Xwx5kLyvsM g+f5Qb/shHSPEi7w9DGw/4wIDDGzoOkAGxQ7 RSQP/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.c om
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************ **********@esta tecomputers.com >,
DFN-CIS NetNews Service <sh******@estat ecomputers.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.c om
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************ **********@esta tecomputers.com >,
DFN-CIS NetNews Service <sh******@estat ecomputers.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/4AAQSkZJRgABAgE ASABIAAD/7RJC...
...
T8Md5MeU9GCbz+S bX7k44U7Crun4Ki n/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.c om
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
11763
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 table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
7
4735
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 example, we have a table of homes and a table of photos. Not every home has a photo. So when I search the photo table for a photo that does not exist I want to display a "No Image Found" gif. Below is my code. homedetail.asp: <img...
13
2358
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 reached yet (I have gone all the way to page 50 on Google's results!!). Here are my requirements: • I have a DataGrid. Everything will be done from here. Everything. No exceptions. Everything will also be done in VB, without any code-behind to...
2
3753
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. At least when I execute the following code, I get some significant network traffic. When I check the database with query analyzer, I see 4 Hex Chars in the image colum. Like 0xe0 etc.
5
10634
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 the dataset because I don't know what datatype to set the dataset column and then set this image to. I saw an example where someone defended a datatable in the global class and defined the column as an object, however, when I define a strongly...
3
5243
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 database and display it in a Image web control dynamically(at runtime). The process after being displayed in the web control, user click insert/add button, it converts the image(jpeg) file to bytes and store it the database with Image or VarBinary...
23
5940
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 on most machines, on some machines I experience this problem: When loading the page a window pops up that asks if I want to open the document show_page.asp. When I click "Open" Interdev pops up and opens up a
2
3311
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" serializeAs="Binary" type="System.Byte" > Doing so, the binary data was saved in the "PropertyValuesBinary" column in "aspnet_profile".
2
7382
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 database and I cannot get the image to work. The columns in the database are of type text. Here is one of the images text (in full) in the database (I hope you can see it):
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9998
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3967
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.