Jump to content
Sign in to follow this  
djmrman

XML Data

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>

Share this post


Link to post
Share on other sites

Why do you think it's not well-formed?  The only issue that an XML validator has is with the initial XML tag with the version.

Share this post


Link to post
Share on other sites

You're wrong, they're using self-closing tags for cinema and session and all of the data is in an attribute.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...