PDA

View Full Version : Invalid procedure call or argument error


tcanny
12-26-2002, 05:16 PM
In the script below I'm getting the Invalid procedure call or argument error and though I have the feeling this is a simple fix that is staring me in the face I can't for the life of me figure out what I'm doing wrong.

The line of code it errors on looks like this:

xml.load(xmlpath);

However if I replace the xmlpath variable with the document name like this ("document.xml") it combines the two files correctly. and displays them.

The complete page which is using the CSJSRequestObject.js to pull info from the URL search string and the msxml2.dll to combine an XML and an XSL file is as follows:

<html>
<body>
<script src="CSJSRequestObject.js" type="text/javascript" language="JavaScript"></script>
<script type="text/javascript" language="JavaScript"><!--

var xmlpath = Request.QueryString("xmlpath");

//-->
</script>

<script language="JavaScript" type="text/javascript">


// Load XML
var xml = new ActiveXObject("MSXML2.DOMDocument");
xml.async = false;
xml.load(xmlpath); <<This is where I'm getting the Invalid procedure call or argument error.

// Load the XSL
var xsl = new ActiveXObject("MSXML2.DOMDocument");
xsl.async = false;
xsl.load("template.xsl");

// Transform
document.write(xml.transformNode(xsl));


</script>

</body>
</html>

Adam20002
12-26-2002, 07:31 PM
Hi,


var xmlpath = Request.QueryString("xmlpath");

is that line of code ASP rather than javascript ? I get the feeling the xmlpath variable is not getting written to as expected. Could you explicitly set xmlpath as a test to see if it runs.

var xmlpath = "validxmlfile.xml";

then see if


xml.load(xmlpath);


works.

tcanny
12-26-2002, 08:30 PM
Originally posted by Adam20002


Could you explicitly set xmlpath as a test to see if it runs.

var xmlpath = "validxmlfile.xml";



Hmm, I didn't think of doing that. "xml.load(xmlpath);" works with the path set explicitly so now I've got to go back and figure out why the Request.QueryString() works on a different page and not on this one. Hmmm. Thanks.

Adam20002
12-26-2002, 10:25 PM
tcanny you seem to be using Request.Querystring in client side javascript which i don't think will work. To pull data from the querystring using javascript you need to play with location .search i think.

Beetles code in the following thread should help.

http://www.codingforums.com/showthread.php?s=&threadid=4555

tcanny
12-27-2002, 03:26 PM
Originally posted by Adam20002
tcanny you seem to be using Request.Querystring in client side javascript which i don't think will work. To pull data from the querystring using javascript you need to play with location .search i think.
I'm using a javascript from here:

http://www.btinternet.com/~a_urquhart/request.html

that allows me to use the Request.Querysting clientside. I've actually got it working on another set of pages. I guess I've just got to figure out what I'm doing wrong that keeps it from working on this page.

Thanks just the same.