Display xml data in html from an xml file specified within another xml file

474 Views Asked by At

Can you help? I have a basic xml file displaying in html.

The xml file is like this:

<videoList>
        <video>
            <pointer>
                <type><![CDATA[image]]></type>
                <lat><![CDATA[52.1]]></lat>
                <long><![CDATA[1.0]]></long>
            </pointer>
            <speaker>
                <firstName><![CDATA[Mr Car Dealer]]></firstName>
                <town><![CDATA[]]></town>
                <description><![CDATA[Car Dealer]]></description>
                <longDescription><![CDATA[A car dealer selling BMW's and Audi's]]></longDescription>
                <videoCaption><![CDATA[captions/bmw.xml]]></videoCaption>
                <video><![CDATA[video/9ADA1C9.flv]]></video>
                <story><![CDATA[]]></story>
                <picture><![CDATA[images/bmw.jpg]]></picture>
            </speaker>
        </video>

All is displaying well except the data within the <videoCaption> tag - this links to another XML file which is made up of the following...

<?xml version="1.0" encoding="utf-8"?>
<tt xml:lang="en" xmlns="http://www.w3.org/2006/04/ttaf1" xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
  <head>
   <styling>
      <style id="1" tts:textAlign="right"/>
      <style id="2" tts:color="transparent"/>
      <style id="3" style="2" tts:backgroundColor="white"/>
      <style id="4" style="2 3" tts:fontSize="10"/>
   </styling>
  </head>
  <body>
   <div xml:lang="en">
    <p begin="00:00:00.20" dur="00:00:02.00">My name is Mr Car.</p> 
    <p begin="00:00:02.30" dur="00:00:03.00">We offer original car parts.</p>

</div>
</body>
</tt>

What I'm trying to do, with no success, is to display the data from the second xml file along side the corresponding data.

In the first xml file there are about 10 entries, and each one links to a separate xml file in the <videoCaption> tag. I have managed to display the second xml file within an iFrame, but I'm not able to style it using css. It does not work in Firefox.

At the moment, I'm displaying the data in html by using dreamweaver spry.

Has anyone got any ideas?

1

There are 1 best solutions below

2
On

In a nutshell, I would grab the the 2nd XML file (assume its on same domain) via an xmlhttprequest and then insert it into the a appropriately positioned DIV.

That way the CSS styles will still be available to it, which seems is not the case when you use an iframe.