Reply
Image in xml
Old 04-25-2008, 03:42 AM Image in xml
Junior Talker

Posts: 1
Hi all first post here hoping someone can help. This is my first shot at xml so please go easy on me if this is pretty obvious. I've been looking at xml for a few days now. Done all the usual things got myself a book and followed some instructions on the net. I can succesfully pull a xml page into my html document and display its contents I,m wondering if it is possible to have a reference to an image in an xml document, maybe the url of the image or something. I'm really not sure where to start with this. Any help would be much appreciated. I have found various topics on this on the net but most seem to be tested in mozilla only or seem a little more complicated than i need.

Last edited by mickeytwoguns : 04-25-2008 at 03:45 AM.
mickeytwoguns is offline
Reply With Quote
View Public Profile
 
Sponsored Links (We share ad revenue):
 
Old 04-27-2008, 02:58 AM Re: Image in xml
chrishirst's Avatar
Super Moderator

Posts: 10,642
Location: Blackpool. UK
it's never going to be easy when you first start with XML.

An image could be referenced in exactly the same way everything else is and it just become another node in the document.

Are you using XSL & XSLT (Transforms) to display the XML in the browser?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 05-02-2008, 01:20 PM Re: Image in xml
nickohrn's Avatar
Weightlifting CS Student

Posts: 480
Name: Nick Ohrn
Depending on what your XML file looks like, you'll probably want to do an XSL transform as you bring the XML file into your web page, as chrishirst said. Fortunately, XSLT shouldn't take you more than 3-4 hours to get the basics down. If you're processing XML documents you've probably run into XPath and that's how you'll retrieve items to manipulate in you XSLT document.

For example, given the following XML file:

Code:
<!-- Standard XML header and parent nodes... -->
<Image>
  <URI>http://example.com/image.png</URI>
</Image>
<!-- Finish the item -->
You'll use an XPath expression like:

Code:
\\Item\Image\URL
and then your XSLT might look like this for when you want to display the image:

Code:
<img src="{.\Image\URI} />
Something along those lines. Check out these XSLT tutorials.
__________________
NickOhrn.com - My personal haven of insight to offer the world.
Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others.
nickohrn is online now
Reply With Quote
View Public Profile Visit nickohrn's homepage!
 
Sponsored Links (We share ad revenue):
 
Reply     « Reply to Image in xml
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML


Page generated in 0.15932 seconds with 14 queries