djmrman Posted January 30, 2019 Share Posted January 30, 2019 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 More sharing options...
justsomeguy Posted January 30, 2019 Share Posted January 30, 2019 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. Link to comment Share on other sites More sharing options...
djmrman Posted January 30, 2019 Author Share Posted January 30, 2019 As the data is not separated within the opening and closing tags I thought they needed to have say <date>20190101</date> ect or am I wrong Link to comment Share on other sites More sharing options...
justsomeguy Posted January 31, 2019 Share Posted January 31, 2019 You're wrong, they're using self-closing tags for cinema and session and all of the data is in an attribute. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now