I have figured it out for myself.
I decided to try using 'use strict', and subsequently found that I was passing the wrong variable into my call to the parser.
I should have been passing the $xsdFileContentsAsScalar variable rather than the $xsdFileContentsArray.
I just got confused. Sorry for wasting your time.