I have a xml file which contains all the text only.
11-13-2002, 06:11 PM
Well, you can set it up to pull a filename from the XML data source and then create a <IMG> tag and insert that tag back into your document; I did something similar, but using straight XSLT. Obviously the images will have to already exist on the machine (server/client) that you want to pull, and you'd need to know the location of 'said' image/flash files.
So if your XML would contain an element like
Then in your Java, you would get those Nodes, and for each node, you would create an <IMG src='myImageVar'> (where 'myImageVar' is a variable that contains the value of each an element) tag and insert that tag, say, into a TABLE object or the like. When the page loads, your images should display.
Now, if you're talking about encoding an actual image or flash file into an XML data file, I'm sure there's a way to do that, but since I've never tried, I can't provide that information.
Hope this made sense, if not, let me know.
11-15-2002, 06:02 PM
Short of trying to explain all that, I am attaching a full blown example that you can see, use, mess with, modify, delete ... whatever.
1 - XHTML Document
1 - Very basic XML File
1 - As basic as I can get it, Java Script
4 - very small images (smilies)
The idea is that we use the XML to name those images in the image folder, load the XML through script, build our HTML IMG tags in script, and then insert them back into the HTML through the DOM.
*take a breath here*
NOW - I have ONLY TESTED THIS IN Internet Explorer 6.0, so please don't tell me it's not working in Netscape. I leave that functionality up to you to figure out (if it's not working); didn't seem to work in Mozilla, so ...
Questions? Comments? Fan mail?
Im sorry dhtroy, but im using:
IM attaching my file, please browse thro' . Thanks
11-18-2002, 06:14 PM
divImages.innerHTML = strHTML;
document.write( strHTML );
They both work just fine, the second implementation obviously using the "document.write" method. You can make this change to the script I original posted to see the results for yourself. Using syntax similar to yours, it would look something like:
document.write( "<img src='" + xmlDoc.getElementsByTagName("Image").item(1).text + "'></img>") I'm just building the string and placing it in a variable called strHTML before passing it to the write() method.
If this still isn't "what your looking for", then I'm not certain I can help without more detailed information.
Hope that helps.