ブラウザで動くこと前提になってるのでちょっと細工が必要。 var navigator = {userAgent: ""}; var document = {getElementsByTagName: function() { return [ {src: ""} ] } }; var window = {document: document}; var xml = wget( 'svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/release/javascript-xpath-latest.js' ); var p = {} eval(xml, p); document