Jump to content

XML Data


djmrman
 Share

Recommended Posts

HI 

I'm a bit stuck at the moment I have worked out how to pull data from a well-formed XML file but I have a problem when it comes to an XML file that is supplied by some cinema software that i would like to use in an HTML file. It doesn't look well formed so my javascript is not working please see link below 

I need to parse the name duration rating and sessions etc to different divs. I could do this if it was well formed but not sure with how it is formed. Hope someone can help thanks jeremy

http://starlightcinema.asuscomm.com:8090/xml/?xt=name&cid=-1&dt=20190101

The parser script that I have amended is

 

<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            type: "GET",
            url: "data.xml",
            dataType: "xml",
            success: xmlParser
        });
    });

function xmlParser(xml) {
    
        $(xml).find("painting").each(function () {
         $("#container").append('<div class="painting"><img src="images/' + $(this).find("image").text() + '"width="200" height="225" alt="' + $(this).find("title").text() + '" /><br/><div class="title">' + $(this).find("title").text() + '<br/>$' + 
        $(this).find("price").text() + '</div></div>');
                $(".painting").fadeIn(1000);
        });
    }
</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...