Hi -
I am using an API to get an XML string. I can use another API call to load the XML string but I need help figuring how to do this. I don’t really need to store the XML I just want to “get” it and then load it in the next HYPE scene immediately.
I’ve read through the older posts about storing JSON with PHP on a server but as they are old posts and I’m not entirely sure how it works I’d love to know if someone could say how I might do this.
Hopefully you can post a version that has all that is being used or called but also it would be a good idea to explain what is meant to happen in the demo?
Tthe API has restrictions on XML loads which looks like we ( probably not you) get no permission error.
If I remember correctly I set up a score before to help figure some noteflight stuff for you before to get around some restrictions but I think in this case I would have to contact noteflight directly..
Which makes it global rather than locally scoped to it's containing function.
But I assume scoreData is the Get returned result var. So I would do something like
window.theScoreData = scoreData
inside the .done promise function
if (typeof window.theScoreData == "undefined") {window.theScoreData= {} };
window.scoreView.getMusicXML().done(function(scoreData) {
console.log(scoreData);
window.theScoreData = scoreData
// do something with the returned score data
});
One more twist on this that I cannot figure out.
I’m trying to load XML data from a file that I have in my resource folder (NFExample.xml)
The Noteflight API has a function that will load an XML String ( loadMusicXML( xmlString ) )so I thought I might need to make the entire document a string by serializing the root node with this:
new XMLSerializer().serializeToString(xmlObject.documentElement);
But I’m not able to get it to work.
This demo file has a basic function set up in the first scene but no real code. @MarkHunte do you have any thoughts on this?