Displaying Images in XML file.

Discussion in 'XML' started by AnandSancheti, Oct 30, 2005.

  1. 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
    AnandSancheti, Oct 30, 2005
    #1
    1. Advertising

  2. AnandSancheti wrote:

    > 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.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Oct 30, 2005
    #2
    1. Advertising

  3. AnandSancheti wrote:

    > 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?

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Oct 30, 2005
    #3
  4. AnandSancheti

    mgungora Guest

    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
    mgungora, Oct 30, 2005
    #4
  5. 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
    AnandSancheti, Oct 31, 2005
    #5
  6. 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.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Oct 31, 2005
    #6
  7. AnandSancheti

    Peter Flynn Guest

    AnandSancheti wrote:

    > 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
    Peter Flynn, Oct 31, 2005
    #7
  8. 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
    AnandSancheti, Nov 1, 2005
    #8
  9. AnandSancheti wrote:

    > I could not get your reply


    It's at <>

    > 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)

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
    David Dorward, Nov 1, 2005
    #9
  10. AnandSancheti

    ron widdison Guest

    ron widdison, Nov 14, 2005
    #10
  11. AnandSancheti

    Peter Flynn Guest

    Peter Flynn, Nov 14, 2005
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David J. Berman
    Replies:
    0
    Views:
    1,403
    David J. Berman
    Jun 24, 2003
  2. Matt
    Replies:
    0
    Views:
    372
  3. jkflens
    Replies:
    2
    Views:
    1,444
    jkflens
    May 30, 2006
  4. megabyte
    Replies:
    0
    Views:
    453
    megabyte
    Aug 22, 2006
  5. Erik Wasser
    Replies:
    5
    Views:
    428
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page