Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2007, 06:33 AM
Registered User
 
Join Date: Nov 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default XML File & Images

Hi Everyone,

I just want to know if it is possible to store an image/sound (or link to) in an XML file.

Basically, I want to add an image my XML file which appears as follows:

<?xml version="1.0" encoding="utf-16"?>
<Questions>
    <Question>
        <quest>Which continent is coloured red?</quest>
    <option>ÇÝÑíÞíÇ
    </option>
    <option>ÇæÑÈÇ
    </option>
    <option>ÇãÑíßíÇ ÇáÌäæÈí
    </option>
    <option>ÇãÑíßíÇ ÇáÔãÇáí
    </option>
    <eng>Africa
    </eng>
    <eng>Europe
    </eng>
    <eng>South America
    </eng>
    <eng>North America
    </eng>
    <ans>Africa
    </ans>
    </Question>
</Questions>


Thanks




 
Old November 4th, 2007, 06:39 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Not directly, not sure why you need to though, surely the XML is not going to be read directly but transformed to another format? You can therefore just store the image path. If you have to store the actual binary data then you'll need to encode it, base 64 is a common choice, as not all characters are allowed in XML.

--

Joe (Microsoft MVP - XML)
 
Old November 4th, 2007, 12:05 PM
Registered User
 
Join Date: Nov 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am creating a multiple choice quiz, with the questions and their associated answers being taken from an XML file. However i want some of the questions to have either a graphic or a sound associated with them.

 
Old November 4th, 2007, 12:08 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Fine, so store the path to the image in the XML, ready for use in an HTML img element.

--

Joe (Microsoft MVP - XML)
 
Old November 4th, 2007, 12:58 PM
Registered User
 
Join Date: Nov 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That answer was staring me straight in the face. Apologies for my incompetence, i'm new to all of this.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploading & retriving Images From Database aaaboye Classic ASP Basics 1 February 20th, 2007 04:03 PM
Getting VB.NET to load & update XML file kyma XML 0 March 19th, 2005 04:58 PM
bindings & images miguel.ossa C# 1 August 20th, 2004 01:02 AM
XML from a DB recordset (removal of &lt;&gt;) Thodoris XML 3 July 13th, 2004 12:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.